I started to use javascript / jquery a few weeks ago, and I'm already stucked. I have an array / object with this stucture:
{
"Array1": [
{
"data1": "value",
"data2": "value"
},
{
"data1": "value",
"data2": "value"
}
],
"Array2": [
{
"data1": "value",
"data2": "value"
},
{
"data1": "value",
"data2": "value"
}
]
}
I'd like to sort this array by Array1 and Array2. I've tried to use .sort() multiple way but it always says: "the object doesn't support this property or method". Is there any way to do this sorting? Could you write me some examples? Thank you very much.
Object.keys()or in afor ... inloop. Relying on property ordering is an extremely bad idea.