I have nested array like this,
var a=[1,2,[3,4,[5,6]]];
I am trying to convert it to flatten array.
var a=[1,2,[3,4,[5,6]]];
var b = a.join(',');
console.log(b);
var c = JSON.parse("[" + b + "]")
console.log(typeof c);
I used join and JSON.parse() methods, I am able to convert to a flat array, but when I do typeof for the array 'c', it says the type as 'object but not an array. My question is as everything is considered as an 'Object' in Javascript. Is returning the array 'c' as 'object' is correct or not?