-1
I need to make a copy of an array without using reference
Example
var a = ["teste", "teste1"];
var b = a;
a[0] = "teste3";
b[0] = "teste4";
console.log(a) //mostrar teste3
console.log(b) //mostrar teste4
-1
I need to make a copy of an array without using reference
Example
var a = ["teste", "teste1"];
var b = a;
a[0] = "teste3";
b[0] = "teste4";
console.log(a) //mostrar teste3
console.log(b) //mostrar teste4
2
For arrays using es6 vc can do so:
var a = ["teste", "teste1"];
var b =[...a];
a[0] = "teste3";
b[0] = "teste4";
console.log(a) //mostrar teste3
console.log(b) //mostrar teste4
Browser other questions tagged angular
You are not signed in. Login or sign up in order to post.
That’s exactly what it was, thank you ^^
– Bruno Miqueas