JSFiddle - React, Tailwind, and code Playground

by black strings

HTML

<div><h1>Prototype Testing</h1></div>
</div>
<div id="test1"></div>
<div id="test2"></div>
<div id="test3"></div>

JavaScript

var s="Protype Testing each instance doesn't share variables";
s="however all prototype instances do share the same methods";

var mod = function(newAge){
	this.name = "default";
  if(newAge){
  	this.age = newAge;
  }else{
  	this.age = 5;
  }	
  
};

mod.prototype.add = function(){
	console.log("adding");
}

var m = new mod();
var m2 = new mod(88);

$('#test1').append(m.age);
$('#test2').append(m2.age);
$('#test3').append(m.age);