Hi! How i can sort this
const list = {
e:5,
a:6.
j:3,
s:1
}
to this?
const list = {
a:6.
e:5,
j:3,
s:1
}
Hi! How i can sort this
const list = {
e:5,
a:6.
j:3,
s:1
}
to this?
const list = {
a:6.
e:5,
j:3,
s:1
}
objects are not sortable, the properties are ordered in a specific way, depending on a few things, and order of insertion
Mmm ok thanks, I will see how to order them before inserting them
No reason to order them before insertion, you can simply order them after the fact. Just use Object.keys(obj).sort()
. Relying on the insertion order is really really bad practice.