JSFiddle - React, Tailwind, and code Playground
JavaScript
//Example 1
var person = {};
person.age = 27;
person.isOld = function() {
return (person.age > 30);
};
//Example 2 - as an object literal
var animal = {
legs: 2,
canWalk: function() {
return (this.legs >= 2);
}
};
alert(person.isOld()); //False
alert(animal.canWalk()); //True