I know dealing with Objects in Javascript is difficult to predict the order of items, but is there a way to organise days of the week in order, and not so they are alphabetical in React or vanilla JS...
I want to know if it's possible to take a given React Object model like this:
this.state = {
days: {
friday: {
temperature: 34
},
monday: {
temperature: 28
},
tuesday: {
temperature: 29
}
}
}
To return in day order, like this:
this.state = {
days: {
monday: {
temperature: 28
},
tuesday: {
temperature: 29
},
friday: {
temperature: 34
}
}
}
I am intrigued as I am having a tough time to believe there's not an out of the box way, without using Arrays etc.
Many thanks for your opinion / help on this :)