Using javascript ES6, I'm trying without success to get an easy algorithm to convert an array who contains a string, no size limit and I need as a result an object with array items as label and every item in a child array, depending on his position, kind of hard to explain,
Here is what I got "before" and what I want "after".
before = ["a","b","c","d"]
after = {
name: "a"
children: [
{
name: "b",
children: [
{
name: "c",
children: [
name: "d"
]
}
]
}
]
}
I'm totally blocked thanks for any help