Problem with var x=JSON.parse(JSON.stringify(Obj));
When Obj contains an Uint8Array(N). x is undefined/
function A(){
this.A=1;
this.B= new Uint8Array(16);
this.s= new Uint8Array(16);
}
A.prototype.setup=function(){
var i;
for(i=0;i<16;i++)this.B[i]=i;
};
function B(){
this.B= 2; // new Uint8Array(16);
this.s= 2; //new Uint8Array(16);
this.A=1;
}
var a=new A();
a.setup();
console.log(a);
var e=JSON.stringify(a);
console.log(e);
var f=JSON.parse(e);
console.log("f= ",f);
console.log(" ");
var b=new B();
console.log(b);
var e1=JSON.stringify(b);
console.log(e1);
var f1=JSON.parse(e1);
console.log("f1= ",f1);
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.
Problem with var x=JSON.parse(JSON.stringify(Obj));
When Obj contains an Uint8Array(N). x is undefined/
The output: