var list = {
value:1,
next: {
value: 2,
next: {
value: 3,
next: {
value: 4,
next: null
}
}
}
}
function showList(list) {
alert(list.value);
while(list.next != null) {
showList(list.next);
}
}
showList(list);
dmFyIGxpc3QgPSB7Cgl2YWx1ZToxLAoJbmV4dDogewoJCXZhbHVlOiAyLAoJCW5leHQ6IHsKCQkJdmFsdWU6IDMsCgkJCW5leHQ6IHsKCQkJCXZhbHVlOiA0LAoJCQkJbmV4dDogbnVsbAoJCQl9CgkJfQoJfQp9CgpmdW5jdGlvbiBzaG93TGlzdChsaXN0KSB7CglhbGVydChsaXN0LnZhbHVlKTsKCXdoaWxlKGxpc3QubmV4dCAhPSBudWxsKSB7CiAgICBzaG93TGlzdChsaXN0Lm5leHQpOwoJfQp9CnNob3dMaXN0KGxpc3QpOw==