Sort array of objects by string property value

0 votes

I have this array of JavaScript objects:

var objs = [ 
    { first_nom: 'Lazslo', last_nom: 'Jamf'     },
    { first_nom: 'Pig',    last_nom: 'Bodine'   },
    { first_nom: 'Pirate', last_nom: 'Prentice' }
];

How can I sort them by the value of last_nom in JavaScript?

May 10, 2022 in Java-Script by Kichu
• 19,040 points
944 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Java-Script

0 votes
1 answer

How to convert an Object {} to an Array [] of key-value pairs in JavaScript?

Hello @kartik, You can use Object.keys() and map() to do this var obj ...READ MORE

answered Sep 4, 2020 in Java-Script by Niroj
• 82,840 points
2,991 views
0 votes
1 answer

Uncaught TypeError: Cannot read property 'setState' of undefined

Hello kartik, You dont have to bind anything, ...READ MORE

answered Apr 27, 2020 in Java-Script by Niroj
• 82,840 points
839 views
0 votes
1 answer

Uncaught TypeError: Cannot read property 'indexOf' of undefined

Hello @kartik, First of all, you don't need ...READ MORE

answered Jun 2, 2020 in Java-Script by Niroj
• 82,840 points
19,575 views
0 votes
1 answer

How to get “value” of file upload input field in jquery?

Hello @kartik, Yes ,you can read the value ...READ MORE

answered Jul 8, 2020 in Java-Script by Niroj
• 82,840 points
12,939 views
0 votes
1 answer

How to replace all occurrences of a string?

Hello @kartik, As an alternative to regular expressions ...READ MORE

answered Aug 28, 2020 in Java-Script by Niroj
• 82,840 points
862 views
0 votes
1 answer

How to get value of selected radio button?

Hello @kartik, Use this: var rates = document.getElementById('rates').value; The rates ...READ MORE

answered Sep 2, 2020 in Java-Script by Niroj
• 82,840 points
1,266 views
0 votes
1 answer

flatting and sorting nested arrays In javascript nodejs

Try this: let myarray = [ [ [ ...READ MORE

answered Jun 9, 2022 in Node-js by Neha
• 9,020 points
519 views
0 votes
0 answers

How to sort an array of integers correctly

Trying to retrieve the greatest and lowest ...READ MORE

Sep 28, 2022 in Java by Nicholas
• 7,760 points
707 views
0 votes
1 answer

How to store an array in localstorage?

Localstorage only supports Strings. So you can ...READ MORE

answered Jul 1, 2019 in Others by sunshine
• 1,300 points
23,060 views
0 votes
1 answer

How to store input value into array then localstorage?

Hello @ abhittac, You have create the array everytime the ...READ MORE

answered Jul 24, 2020 in Java-Script by Niroj
• 82,840 points
9,188 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP