JSFiddle - React, Tailwind, and code Playground

by Eduard Dyckman

JavaScript

const zero = {next: null};

const inc = (num) => num.next || (num.next = {next: null});

const one = inc(zero);
const two1 = inc(one);
const two2 = inc(one);

const sum = (a, b) => {
	let iter = zero; 
  let result = b;
  while (iter !== a) {
  	result = inc(result);
    iter = inc(iter);
  }
  return result;
}

const three = inc(two1);
const four = inc(three);
console.log('!!!', four === )