I have a function that converts a list to an array.
function listToArray(list) {
let arr = [];
for (let node = list; node; node = node.rest) {
arr.push(node.value);
}
return arr;
}
What's confusing to me is the node variable in the for loop. This bolded node: (let node = list; node; node = node.rest). How that bolded "node" works? What it is used for?