当前位置:网站首页>Basic data type and complex data type
Basic data type and complex data type
2022-06-27 22:31:00 【Program Altman】
let Variables are declared , And variable quantity , If the assignment is repeated , And the latter will cover the former
const Declared constant , And will not change , You can't repeat the assignment , And the value must be assigned when declaring
0.1 + 0.2 == 0.30000000000000004 Why? ?
Because machine language is converted to binary , There is a lack of precision in binary calculation ,
Seven basic data types :
1、Number: Numerical type The range of data calculation is 22013 ~ -22013
2、String: character string ,js Can identify + Both sides of No , But where there is one side + Number That is splicing
3、Boolean: Only eight will turn into false, Everything else true, Namely Boolean(0),Boolean(0n),Boolean(undefined),
Boolean(null),Boolean(false),Boolean(" "),Boolean(NaN),Boolean( ), It is mainly used for judging
4、Null: Null value give an example : There is a piece of land that is nominally mine , But there is nothing on the ground , Not taking up space is null,
5、undefined: give an example : There is a piece of land that is nominally mine , But there are my belongings on the ground , Occupied space is undefined,
6、Symbol: Unique value
7、Bigint: Super integer , When using, you must add n
Complex data type :
arr[] ,object{}, function function, Built-in objects :window ,document(Dom), Math Mathematical objects ,Date Date object , Except for the foundation type , Others are complex data types
An array can hold multiple pieces of data , The serial number from 0 Starting number , and lengrh It's from 1 Start counting , The value taking method is similar to arr[]
Common object / Instance object { } Is stored in the form of key value pairs , Key name : Key value , Value method 1:obj spot , And the dot cannot be followed by a string or a number , Strings and numbers must be wrapped in brackets , Value method 2:obj[" "] , If the value is taken without quotation marks in the brackets , Will be the first to identify whether it is a variable
What is stack memory and heap memory ?
The data stored in the basic data type will be stored in the stack memory , Data stored in complex data types will be stored in heap memory ,
So why are they not equal ? The reason is because : For example arr The saved data will be saved to 13 building 1307 between , and arr1 The saved data will be saved to 14 building 1307 between , All say their memory addresses are different , It won't be equal
let arr = [1,2," Finch ",true]
let arr1 = [1,2," Finch ",true]
console.log(arr == arr1); //false
How to modify and add values in common objects
let age = "age"
let obj = {
name:" Jay Chou ",
age:18,
"abc" :"123",
10:123,
"10":" Hello ",
}
// modify
obj.name = " Jerungo "
// newly added
obj.hobby = " Love playing basketball "
// Modified value
obj[10] = "ABC"
console.log(obj);
console.log(obj.length);
边栏推荐
- 解决本地连接不上虚拟机的问题
- The problem of minimum modification cost in two-dimensional array [conversion question + shortest path] (dijkstra+01bfs)
- [MySQL] database function clearance Tutorial Part 2 (window function topic)
- Is it safe to open a stock account through the account opening link given by the CICC securities manager? I want to open an account
- 关于davwa的SQL注入时报错:Illegal mix of collations for operation ‘UNION‘原因剖析与验证
- Software test automation test -- interface test from entry to proficiency, learn a little every day
- The karsonzhang/fastadmin addons provided by the system reports an error
- 百万年薪独家专访,开发人员不修复bug怎么办?
- Gbase 8A method for reducing the impact on the system by controlling resource usage through concurrency during node replacement of V8 version
- Matlab finds the position of a row or column in the matrix
猜你喜欢

6G显卡显存不足出现CUDA Error:out of memory解决办法

Common problems encountered by burp Suite

CUDA error:out of memory caused by insufficient video memory of 6G graphics card

Use Fiddler to simulate weak network test (2g/3g)

Day 7 of "learning to go concurrent programming in 7 days" go language concurrent programming atomic atomic actual operation includes ABA problem

Management system itclub (medium)

Crawler notes (3) -selenium and requests

Introduce you to ldbc SNB, a powerful tool for database performance and scenario testing

Luogu p5706 redistributing fertilizer and house water

渗透学习-sql注入过程中遇到的问题-针对sort=left(version(),1)的解释-对order by后接字符串的理解
随机推荐
Educational Codeforces Round 108 (Rated for Div. 2)
How to prioritize the contents in the queue every second
Codeforces Round #717 (Div. 2)
年薪50W+的测试大鸟都在用这个:Jmeter 脚本开发之——扩展函数
二维数组中修改代价最小问题【转换题意+最短路径】(Dijkstra+01BFS)
Interview question 3 of software test commonly used by large factories (with answers)
average-population-of-each-continent
The problem of minimum modification cost in two-dimensional array [conversion question + shortest path] (dijkstra+01bfs)
《7天学会Go并发编程》第7天 go语言并发编程Atomic原子实战操作含ABA问题
中金证券经理给的开户链接办理股票开户安全吗?我想开个户
Software test automation test -- interface test from entry to proficiency, learn a little every day
CUDA error:out of memory caused by insufficient video memory of 6G graphics card
The "business and Application Security Development Forum" held by the ICT Institute was re recognized for the security capability of Tianyi cloud
How to do function test well? Are you sure you don't want to know?
mysql 大于 小于 等于符号的表示方法
Deep learning has a new pit! The University of Sydney proposed a new cross modal task, using text to guide image matting
Codeforces Round #723 (Div. 2)
Codeforces Round #716 (Div. 2)
YOLOv6:又快又准的目标检测框架开源啦
Stm32f107+lan8720a use stm32subemx to configure network connection +tcp master-slave +udp app