JSFiddle - React, Tailwind, and code Playground
by Jonny
JavaScript
function Person(name, age, country){
this.name = name;
this.age = age;
this.country = country;
}
var person1 = new Person("John", 20, "Canada");
// EXAMPLE 1: greet is declared with an anonymous function
Person.prototype.greet = function(){
console.log("Hello my name is " + this.name);
}
// EXAMPLE 2: greet is declared with a function named greet
Person.prototype.greet = function greet(){
console.log("Hello my name is " + this.name);
}