What is the relationship between function and object in javascript
This article mainly explains the "what is the relationship between functions and objects in javascript". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what is the relationship between functions and objects in javascript".
Description
1. The object is created by function, the object is a collection of several properties, and all reference types are objects.
2. Each function has an attribute prototype, whose attribute value is an object.
By default there is only one property called constructor, which points to the function itself.
Example
Var obj = {name: 'zs', age: 20}; / / equivalent to var obj = new Object (); obj.name =' zs';obj.age = 20 Expand the relationship between prototype objects and objects in JavaScript, objects are composed of one or more groups of attributes and values: {key1: value1, key2: value2, key3: value3,} Thank you for reading. This is the content of "what is the relationship between functions and objects in javascript". After the study of this article, I believe you have a deeper understanding of the relationship between functions and objects in javascript. The specific use situation still needs to be verified by practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!