JSFiddle - React, Tailwind, and code Playground
by Darby Rathbone
JavaScript
var node ={
unshift: function(e){
var n = this;
}
add: function (e) {
if (typeof this.value == 'undefined') {this.value = e;}
else {
if (typeof this.next == 'undefined') {
this.next = Object.create(node);
this.next.add(e);
}
else{
this.next.add(e);
}
}
},
all: function () {
if (typeof this.next == 'undefined') {return this.value;}
return this.value + this.next.all();
}
} ;
function linkedlist(a){
return Object.create(node);
}
var first = linkedlist('new');
first.add('new');
first.add('new2');
first.add('new3');
console.log(first);
console.log(first.all());