Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Case Analysis of JavaScript data Type usage

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "JavaScript data type use example analysis". The explanation content in this article is simple and clear, easy to learn and understand. Please follow the idea of Xiaobian and go deep into it slowly to study and learn "JavaScript data type use example analysis" together.

(1) Boolean boolean

Boolean (logical) can have only two values: true or false

var x=true;

var y=false;

(2) null and undefined

null means no object, no value here

undefined means missing value, should have value but not defined

var x = null;

var y = undefined

(3)symbol

Symbol function can accept a string as a parameter, providing a description for the newly created Symbol, used to display it on the console or as a string, easy to distinguish

let name = Symbol();

let name2 = Symbol("bb");

console.log(name); // Symbol()

console.log(typeof name); // "symbol"

console.log(name,name2); //Symbol() Symbol(bb)

console.log( name === name2); // false

(4) Object

Objects are separated by braces. Inside the brackets, the properties of the object are defined in key-value pairs (name : value). Properties separated by commas

//Spaces and breaks don't matter. Declarations can span multiple lines

var obj = {

"name":"zhang san",

"age":18

}

(The key name can also be used without quotation marks)

Reading attributes in objects:

name = obj.name

//or

name = obj['name']

Thank you for reading, the above is the content of "JavaScript data type use example analysis", after the study of this article, I believe that everyone has a deeper understanding of JavaScript data type use example analysis, the specific use of the situation also needs to be verified by practice. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report