JSFiddle - React, Tailwind, and code Playground

by Vladymyr Shevchuk

JavaScript

const foobar = {
  next: {
    value: 1,
    next: {
      value: 2,
      next: null
    }
  }
};

let obj = foobar.next;

console.error(obj);

while (obj) {
  console.log('1', obj.value);
  obj = obj.next;
}