I have an Object like this.
let code ={
2: 'name',
name: 'name',
1: 'name',
key: 'name',
0: 'name'
}
When we try do console.log, we get a value as below.
{
0: "name"
1: "name"
2: "name"
key: "name"
name: "name"
}
Basically the number keys are getting sorted and the remaining keys are getting printed in the same order that we added. Can i know the reason behind this action? And how does this is happening behind the scene. Please explain in detail.