Home > Web Front-end > JS Tutorial > What is obj in js

What is obj in js

anonymity
Release: 2019-05-29 14:49:46
Original
9546 people have browsed it

JavaScript variables are containers of data values.

This code assigns a single value (porsche) to a variable named car:

var car = "porsche";

Objects are also variables. But objects contain many values.

What is obj in js

This code assigns multiple values ​​​​(porsche, 911, white) to a variable named car:

var car = {type:" porsche", model:"911", color:"white"};

Values ​​are written in name:value pairs (name and value are separated by colon).

JavaScript objects are containers of named values

obj To put it bluntly, it is document.getElementById(whichlink "menu")

This is equivalent to assigning the value of document.getElementById(whichlink "menu") to a variable in obj

Accessing object properties

You can access in two ways Attribute:

objectName.propertyName
Copy after login

or

objectName["propertyName"]
Copy after login

The above is the detailed content of What is obj in js. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
What are JavaScript hook functions?
From 1970-01-01 08:00:00
0
0
0
What is JavaScript garbage collection?
From 1970-01-01 08:00:00
0
0
0
c++ calls javascript
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template