I have two array with custom key but when i want to merge them JavaScript return emtpy array.
let x = [];
x['a'] = 1;
let y = [];
y['b'] = 2;
console.log(x.concat(y));
console.log([...x, ...y]);
There is any way to use JavaScript function two merge them or i have to use for and iterate all items??
let y = []; y['b'] = 2results in an array with a property with the key'b'and the value2.concatand...only consider properties with integral keys. Please explain what you are trying to accomplish as I doubt you are using the correct data structures.