I have an array which contains arrays which describe the children inside an object as strings.
I am having trouble producing the desired result with the supplied input.
let obj = {} let arr = [ ["one", "two", "three", "four"], ["one", "two", "three", "four"], ["one", "two", "three", "four", "five"], ["one", "hi"] ] console.log(JSON.stringify(obj, null, 4)) Desired output:
let result = { one: { children: { two : { children: { three: { children: { four: { children: { five: {} } } } } } }, hi: {} } } }