JSFiddle - React, Tailwind, and code Playground

by karthick6891

HTML

<!-- prototype basics -->
<button id="testBtn">Click Me</button>

JavaScript

var Person = function() {
  this.canTalk = true;
};

Person.prototype.greet = function() {
  if (this.canTalk) {
    alert('Hi, I am ' + this.name);
  }
};


Person.prototype.greet = function() {
 alert("2");   
}
var per = new Person();

per.greet();