prevent an object to extend in JavaScript

JavaScript

🤖 Code Explanation

/* ************************** */
/* ************************** */





















var Person = function(name) {
this.name = name;
}
Person.prototype.getName = function() {
return this.name;
}
var p1 = new Person("John");
console.log(p1); // Person { name: 'John' }

Download SpellBox today