If you want to get array from array in JavaScript then this code snippet works
this is good question for you data-structure and algorithm problem solving skill
Firstly I get typeof every iterative typeof(data) this function and when i sort all object then i use specific array property that only array have other object doesn't have any property like this data[i]
const dataArray = [[232,32],[232,3232],23,{"Key":"Value"},"Stalin"];
const otherArray = [];
let i =0;
for (const data of dataArray) {
const typeData = typeof(data);
// console.log(test);
if(typeData.includes('object')){
if (data[i]) {
otherArray.push(data)
}
}
i++;
}
console.log(otherArray);

0 Comments