//strings.js
var A="1234567890";
var B=A;
console.log(B);console.log(B.length);
B=B+B;
console.log(B);console.log(B.length);
//out of memory if continued
//B=B+B;
//console.log(B);console.log(B.length);
//B=B+B;
//console.log(B);console.log(B.length);
B=A;
console.log(B);console.log(B.length);
B+=B;
console.log(B);console.log(B.length);
B+=B;
console.log(B);console.log(B.length);
Produces:
>echo(0);
1234567890
10
12345678901234567890
20
1234567890
10
12345678901234567890
20
ERROR: Out of Memory!
WARNING: Out of memory while appending to array
Execution Interrupted
=undefined
>
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.
Produces: