If I have an array:
const arr = ['this', 'is', 'my', 'test'];
How can I dynamically do
myObj[arr[0]][arr[1]][arr[2]]
If I have an array:
const arr = ['this', 'is', 'my', 'test'];
How can I dynamically do
myObj[arr[0]][arr[1]][arr[2]]
I am not sure if this is what you are looking for? enter link description here
const arr = ['this', 'is', 'my', 'test'];
var Obj = arr.join(" ");
console.log(Obj)
--------------------------------please see this as updated ---------------------
const arr = ['this', 'is', 'my', 'test'];
var Obj = [];
var i;
for (i = 0; i < arr.length; i++) {
Obj.push([arr[i]])
}