JSFiddle - React, Tailwind, and code Playground
by mmarcon
JavaScript
var Node = function(){
this.next = null;
this.content = null;
};
var LList = function() {
this.head = null;
this.add = function (obj) {
var n = new Node();
n.next = this.head;
n.content = obj;
this.head = n;
};
this.print = function(){
var next = this.head;
while (next != null) {
document.write(next.content);
next = next.next;
}
};
};
var l = new LList();
l.add(1);
l.add(2);
l.print();