I am pretty new to Javascript, so this might be a silly question. but is it possible to add arrays together? like...
var m2 = new Array(2).fill(TEST); var m4 = m2 + m2;
or is there another technique in which i can do such a thing? Thank you!
I am pretty new to Javascript, so this might be a silly question. but is it possible to add arrays together? like...
var m2 = new Array(2).fill(TEST); var m4 = m2 + m2;
or is there another technique in which i can do such a thing? Thank you!
Joing two array like []+[]
will result to a string. You can merge two array using e destructuring
or using concat
var m2 = new Array(2).fill('TEST');
var m4 = [...m2, ...m2];
var m5 = m2.concat(m2)
console.log(m4);
console.log(m5)