• Learn how to make JavaScript code execute faster.
• Explore techniques for caching JavaScript code.
• Understand the cost of using objects and methods.
Creating Prototypes
The prototype property lets you define and add custom methods and properties to objects. Before using the prototype property to assign a method, create a function that defines what actions will be performed. Use the JavaScript keyword this inside your function to refer to the current instance of the object.
To have the method return a value to the user, use the JavaScript keyword return.
Once you have created your function, you can assign it as a method. Thesyntax for assigning a function to a prototype is as follows:
0 commentaires: