JSFiddle - React, Tailwind, and code Playground
JavaScript
function Animal(){}
Animal.prototype.getName = function() { return this.name;};
Animal.prototype.setName = function(n) { this.name = n; };
function Loup(){
this.name = "toto";
}
Loup.prototype = Animal.prototype;
//Test 1
var c = 1000000;
var loups = [];
var j;
for (j = 0; j < c; j++) {
loups[j] = new Loup();
}
var tstart = 0;
var tend = 0;
tstart = new Date().getTime();
for (j = 0; j < c; j++) {
loups[j].setName("tata");
loups[j].getName();
}
if(j=1000000) tend = new Date().getTime() - tstart;
document.write("tempo " + tend / 1000.0 + " seconds<br/>");