JSFiddle - React, Tailwind, and code Playground

by karthick6891

JavaScript

/*var Fee = function(x) {  
	var fi = function() {
  	console.log("from fi", x);  
  }
	this.fo = function() {
  	console.log("from fo", x);  
  }
}

Fee.prototype.fum = function() {		
		console.log("from fum",x); 
}


var newfee = new Fee(7);
newfee.fi();
newfee.fo();
newfee.fum();*/



var Fee = function(x) {  
	this.fi = function() {
  	console.log("from fi", x);  
  };
	this.fo = function() {
  	console.log("from fo", x);  
  };
	this.getX = function() {
  	return x;
  };
}

Fee.prototype.fum = function() {		
		console.log("from fum", this.getX()); 
}


/*var newfee = new Fee(7);
newfee.fi();
newfee.fo();
newfee.fum();*/


for (var i = 0; i < 100; i++) {
	var newfee = new Fee(i);
}


var o = Object.create(null, {
	x: {
     writable: false
  },
  init: {
  	value: function(x) {
      this.x = x;
    	console.log("from init", x); 
      return this;
    }
  },
	fye: {
    value: function() {
    	console.log("from fye", this['x']);  
    }
  },
  foo: {
    value: function() {
    	console.log("from f00", this['x']);  
    }
  }, 
  fum: {
    value: function() {
    	console.log("from fum", this['x']);  
    }
  }
  
});

//o.init(6)
//o.fye()
//console.log(o);



var Fee = Object.create(null);
Fee.prototype = {
	fye: function() {
  	return console.log("from fo", this.x);  
  },
  foo: function() {
  	return console.log("from fo", this.x);  
  },
  fum: function() {		
		return console.log("from fum", this.x); 
	}
};
 
var fee = Object.create(Fee.prototype, {
  x:   { writable: false,  configurable:true, value: 12 }
}); 
fee.x = '9'
fee.foo()