Today is another interesting find:
console.clear();
var a ={};
a.p1 = "kiazen";
a["p2"] = "krook";
a[0] = 10;
a[1] = 20;
a[2] = 30;
a[3] = 40;
console.log(a)
console.log(JSON.stringify(a));
console.clear();
var a =[];
a.p1 = "kiazen";
a["p2"] = "krook";
a[0] = 10;
a[1] = 20;
a[2] = 30;
a[3] = 40;
console.log(a)
console.log(JSON.stringify(a));
var a =[];
a.p1 = "kiazen";
a["p2"] = "krook";
a[0] = 10;
a[1] = 20;
a[2] = 30;
a[3] = 40;
console.log(a)
console.log(JSON.stringify(a));
var a= [];
//=> this implies 'a' as associative array and not oject
or//=> this implies 'a' as associative array and not oject
var a= {};
//=> this implies 'a' as object.
//=> this implies 'a' as object.
So my interpretation leads that serialization of javascript object/array depends on the first initialization fo the object.
No comments:
Post a Comment