const arr = [
'this', [
'is', 'an', [
'example', 'of', [
'multidimentional', 'array'
]
]
]
];
const arrayToString = (arr) => {
let str = '';
for(let i = 0; i < arr.length; i++){
if(Array.isArray(arr[i])){
str += `${arrayToString(arr[i])} `;
}else{
str += `${arr[i]} `;
};
};
return str;
};
console.log(arrayToString(arr));
//output : this is an example of multidimentional array