JSFiddle - React, Tailwind, and code Playground
by shravan
JavaScript
var person = {
firstName: "Shravan Kumar",
lastName: "Kasagoni",
printName: function () {
console.log(this.firstName + " " + this.lastName);
}
};
console.log("firstName" in person); // true
console.log(person.hasOwnProperty("firstName")); // true
console.log("toString" in person); // true - prototype property
console.log(person.hasOwnProperty("toString")); // false - prototype property
console.log(person.printName.length); //return the arity of method
console.log("name" in person); // false - property doesn't exists
console.log(person.propertyIsEnumerable("name")); // flase
console.log("firstName" in person); // true
console.log(person.propertyIsEnumerable("firstName")); // true
console.log("length" in properties); // true - prototype property
console.log(properties.propertyIsEnumerable("length")); // false - prototype property