JSFiddle - React, Tailwind, and code Playground
by Slava Slava
JavaScript
let list = {
value: 1,
next: {
value: 2,
next: {
value: 3,
next: {
value: 4,
next: null
}
}
}
};
function printList(l) {
console.log('value ', i.value)
if(!Boolean(i.next)) {
/* console.log('value last ', i.value) */
return i.value
}
return printList(l.next)
}