let menu = {
width: 200,
height: 300,
title: "My menu"
};
let myF = obj => { for(let prop in obj){
if(typeof obj[prop] == "number" ){
obj[prop] *= 2}
}
}
myF(menu);
console.log(menu);
I have created a function that multiplies all numeric properties. While I was working in online code editor jsfiddle, the properties of menu object were surprisingly sorted alphabetically:
{
height: 600,
title: "My menu",
width: 400
}
I just wonder why online code editors behave like that. Also, in my opinion, this feature can easily misdirect while working with massive code lines, so is it a bad habit to code in such places?