+ 1
I want to sort my objects properities alphabeticaly help me.
give example.
12 ответов
+ 3
object props:
just use array of keys returned by Object.keys(target_obj), sort it and iterate it to output values as you want/need...
array string items:
just sort the array (if once dimension, else with nested arrays requires a sort callback), and iterate...
array numeric items:
just sort the array using basic sort callback (ie: (a,b) => a-b), and iterate...
however, your question is not clear, and you could get more accurate answers by sharing your code and providing usefull description of your expects ;P
+ 2
Jamal sort doesn't works on object.
+ 1
Amirhusein san solution is sorting object alphabetically only.
+ 1
Amirhusein please check properly
& mention more details ' - '
+ 1
Sorting will not work
0
it dosn,t work anyway.
0
I mean this:
A<br>or obj[0]
B<br> or obj[1]
.
.
.
z<br> or obj[26]
0
Alex
Bob
.
.
.
Zach
0
forget I will handle my own pain.
0
provide your full attempt to get more accurate answer ^^
- 2
it isn,t what I want actually it dosn,t matter it,s, object or array I want to see proper order not like this.