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' }
More problems solved in JavaScript
-
prevent an object to extend
two functions that make sum two vectors and make their dot product
invoke javascript code in an iframe from parent page
print the contents of web page
Determine the factors of a number.
remove falsy values from an array
detect a mobile browser without regexp
prevent promises swallowing errors
create an object with prototype
how to connect to mysql
How do you find duplicate characters in a given string
Improve a given function so that it runs in O(log n) time
calculate fibonacci series with multiplication instead of addition
change the style of a html element
How to check if the given number is a prime number
give an example usage of rangeoverflow property
can i add getters and setters using defineproperty method
redirect new page in javascript
assign default values to variables
call the constructor of a parent class
avoid receiving postmessages from attackers