If you have an object var o = {n:3,s:"str"}and you try array-access the properties, no matter what numeric value you put into the square bracket, it does not give you properties back... because the number is just another 'name'... but you can use it to add more attributes, for example:
var o = {n:3,s:"str"};
console.log("o[1]:", o[1]); // ---> undefined
o[1]="x1"; // ---> adds new property w/ (numeric) name ```1``` to object ```o```
// and set the properties value to string "x1"
console.log("o[1]:",o[1]); // ---> access/show property w/ name ```1```: ---> "x1"
o[1]: undefined
o[1]: x1
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
If you have an object
var o = {n:3,s:"str"}
and you try array-access the properties, no matter what numeric value you put into the square bracket, it does not give you properties back... because the number is just another 'name'... but you can use it to add more attributes, for example: