Linked Questions
515 questions linked to/from Sort array of objects by string property value
1263
votes
23
answers
1.5m
views
Sort array by firstname (alphabetically) in JavaScript [duplicate]
I got an array (see below for one object in the array) that I need to sort by firstname using JavaScript.
How can I do it?
var user = {
bio: null,
email: "[email protected]",
...
368
votes
14
answers
375k
views
Sort objects in an array alphabetically on one property of the array [duplicate]
Let's say you have a JavaScript class like this
var DepartmentFactory = function(data) {
this.id = data.Id;
this.name = data.DepartmentName;
this.active = data.Active;
}
Let's say you ...
84
votes
1
answer
133k
views
How to sort object array based on key in typescript [duplicate]
I have a candidate object with properties
candidateid:number;
name:string;
I wish to sort an array of such objects based on the name property. How can I achieve this in TypeScript in angular 2?
51
votes
5
answers
128k
views
How can I sort a javascript array of objects numerically and then alphabetically? [duplicate]
Possible Duplicate:
Sorting objects in an array by a field value in JavaScript
How can I sort an array of objects numerically (by id) then alphabetically (by name)?
The current way is providing ...
49
votes
3
answers
271k
views
Sort Array of object by object field in Angular 6 [duplicate]
I am getting an array of "product"s from a resolver getting data from a json endpoint.
ngOnInit() {
this.products = this._route.snapshot.data.products;
console.log('products: ', this.products);
}
...
23
votes
5
answers
16k
views
Sort JavaScript array of Objects based on one of the object's properties [duplicate]
I've got an array of objects, each of which has a property name, a string. I'd like to sort the array by this property. I'd like them sorted in the following way..
`ABC`
`abc`
`BAC`
`bac`
etc...
How ...
14
votes
5
answers
32k
views
javascript sorting array of objects by string property [duplicate]
I am trying to sort an array of object by a property title. This the code snippet that I am running but it does not sort anything. The array is displayed as it is. P.S I looked at previous similar ...
3
votes
3
answers
37k
views
Sort by index an array [duplicate]
Look at the code below:
var exemples = [
{
'name' : 'd',
'index' : 3
},
{
'name' : 'c',
...
2
votes
5
answers
12k
views
Javascript: How to sort an array of records by values in one of the fields? [duplicate]
Possible Duplicate:
Sorting objects in an array by a field value in JavaScript
Suppose I have an array of records: [{a:0,b:0},{a:2,b:1},{a:1,b:2}]
which I wish to sort in descending order of the a ...
7
votes
1
answer
11k
views
Sort Array of Objects by specific key value | Javascript [duplicate]
I'm having trouble sorting a specific array of objects from a small personal project I'm working on. I have never had trouble using the Array.prototype.sort() function before, but I wonder if ...
3
votes
3
answers
20k
views
How to sort JSON array elements in descending order? [duplicate]
In my index.html, I receive data from server which is in this order:
[
{id: 1, keyOne: valueOne, keyTwo: valueTwo},
{id: 2, keyOne: valueOne, keyTwo: valueTwo},
{id: 3, keyOne: valueOne, keyTwo:...
4
votes
2
answers
6k
views
javascript sort and sort equals on result. how? [duplicate]
I have a problem sorting objects of structure {"name", "count"}:
1. name => "aaa", count => 1
2. name => "bbb", count => 2
3. name => "ccc", count => 3
4. name => "ddd", count =&...
9
votes
1
answer
4k
views
sorting a json list? [duplicate]
Possible Duplicate:
Sorting objects in an array by a field value in JavaScript
var myData = [
{"Identifier":1,"Naam":"Van Der Valk","Adres":"Europaweg 218","Postcode":"1238AC","...
0
votes
2
answers
4k
views
how to sort array os objects which is alphanumeric [duplicate]
I am trying to sort array as shown of objects which contains alphanumeric value
[
{ bayid="A1", status=0},
{ bayid="A7", status=0},
{ bayid="A6", status=0},
{ bayid="A5", status=0}
]
i am ...
1
vote
2
answers
5k
views
Javascript sort array of objects on key values [duplicate]
I was trying to sort array of objects which contains status key which has "online","offline","Busy" , so just wanted to sort the array in such a way that all "online" would appear on top followed by "...