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