JSFiddle - React, Tailwind, and code Playground
by reggi
HTML
<ul class="names"></ul>
JavaScript
/*
var Person = function(string){
this.name = string;
this.$item = $("<li>");
};
Person.prototype.putName = function(){
this.$item.text(this.name)
$(".names").append(this.$item);
return this;
}
Person.prototype.removeName = function(){
this.$item.remove();
return this;
}
var t = new Person("Thomas").putName();
var g = new Person("George").putName();
var m = new Person("Matthew").putName();
t.removeName();
*/
var Person = function(string){
this.name = string;
this.$item = $("<li>");
};
Person.prototype.putName = function(){
this.$item.text(this.name)
$(".names").append(this.$item);
return this;
}
Person.prototype.removeName = function(){
this.$item.remove();
return this;
}
var t = Person("Thomas").putName();