Get the App
SLTechnology News&Howtos  ›  Development  › 

What is the relationship between function and object in javascript

Shulou Source: shulou.com Published: 2022-06-03 17:31:16 10月28日 Update

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!

Tags: Objects functions attributes learning content prototypes only examples that is ideas situations directions articles more knowledge knowledge points equivalence articles types follow Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Redmi Shulou Technology Shulou Information Linux