JSFiddle - React, Tailwind, and code Playground

by Ron Eaglin

HTML

<input type="button" value="Click me" onclick="show();"/>

JavaScript

function Node(_content) {
  this.content = _content;
  this.next = null;
}

function List() {
  this.head = null;
}

function f(n) {
  if (n == null) return " ";
  return f(n.next) + n.content;
}

function show() {
 alert(f(a.head));
}

var a = new List();
a.head = new Node("Node 1");
a.head.next = new Node("Node 2");
a.head.next.next = new Node("Node 3");