JSFiddle - React, Tailwind, and code Playground

by veer712

JavaScript

var employee = function(){
  this.name = "Veer";
  this.age = "31";
  this.salary = "3000";
  this.display = function(){
    alert(this.name + " is " + this.age + " years Old!!");
  }
}

var emp = new employee();

employee.prototype.sal = function(){  
  alert("Salary is: " + this.salary + "!!");
}

employee.prototype.address = function(){
  this.location = "Pune";
  alert(this.name + " lives in " + this.location + "!!");
}

emp.name = "Raul";
emp.age = "30";
emp.display();
emp.address();
emp.sal();