I'm stuck on this exercise and could really use some help to complete it. Can someone show me how to finish it and explain the solution? Thanks a lot!
There's a list value called "values" that needs to be converted into an array format like [1, 2, 3]
let list = {
value: 1,
rest: {
value: 2,
rest: {
value: 3,
rest: null
}
}
};
The provided hint suggests using a loop, but I'm still unsure about the next steps.
for (let node = list; node; node = node.rest) {
}
Your guidance is greatly appreciated! Thanks in advance!