x = array_to_list([10, 20]);
console.log(JSON.stringify(x));
function list_to_array(list) {
arr = [];
for (const property in list) {
if (property == "value") {
arr.push(property);
} else if (property == "rest") {
for (const property in rest) {
arr.push(property);
}
}
}
}
console.log(JSON.stringify(list_to_array(x)));
but I get the error Uncaught ReferenceError ReferenceError: rest is not defined how can I iterate in the rest object ? or how would you do this function
this functions transform a list to an array