I have an array like let a = [[[1,2], [3,[1,2,3]]], [2,3]]
and want to access the elements using a method/way to return the values like : 12312323
or [1,2,3,1,2,3,2,3]
how can I approach the solution in javascript/nodeJS? thanks
I have an array like let a = [[[1,2], [3,[1,2,3]]], [2,3]]
and want to access the elements using a method/way to return the values like : 12312323
or [1,2,3,1,2,3,2,3]
how can I approach the solution in javascript/nodeJS? thanks
You can use Array.flat()
let a = [[[1,2], [3,[1,2,3]]], [2,3]]
let op = a.flat(Infinity)
console.log(op)
You can check browser compatibility here compatibility