What does the prototype property of a function allow you to do?

  • a) Create a new instance of the function.
  • b) Add new properties and methods to all instances created by that function.
  • c) Access the parent prototype of the function.
  • d) Change the function's name and scope.
The prototype property of a function in JavaScript allows you to add new properties and methods to all instances created by that function. This is useful for implementing inheritance and sharing common behavior among objects created from the same constructor function. It doesn't create new instances or change the function's name or scope.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *