当前位置:网站首页>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);
边栏推荐
- How to design an elegant caching function
- Go from introduction to actual combat - task cancellation (note)
- Solution to the error of VMware tool plug-in installed in Windows 8.1 system
- Système de gestion - itclub (II)
- Common problems encountered by burp Suite
- 01 golang environment construction
- Codeforces Round #723 (Div. 2)
- Go from introduction to practice -- definition and implementation of behavior (notes)
- 對話喬心昱:用戶是魏牌的產品經理,零焦慮定義豪華
- go语言切片Slice和数组Array对比panic: runtime error: index out of range问题解决
猜你喜欢
![\w和[A-Za-z0-9_],\d和[0-9]等价吗?](/img/96/2649c9cf95b06887b57fd8af2d41c2.png)
\w和[A-Za-z0-9_],\d和[0-9]等价吗?

管理系統-ITclub(下)

The "business and Application Security Development Forum" held by the ICT Institute was re recognized for the security capability of Tianyi cloud

管理系统-ITclub(中)

使用sqlite3语句后出现省略号 ... 的解决方法

Experience sharing of meituan 20K Software Test Engineers

Crontab scheduled task common commands

7 jours d'apprentissage de la programmation simultanée go 7 jours de programmation simultanée go Language Atomic Atomic Atomic actual Operation contains ABA Problems

二维数组中修改代价最小问题【转换题意+最短路径】(Dijkstra+01BFS)

《7天学会Go并发编程》第六天 go语言Sync.cond的应用和实现 go实现多线程联合执行
随机推荐
二维数组中修改代价最小问题【转换题意+最短路径】(Dijkstra+01BFS)
软件缺陷管理——测试人员必会
Go from introduction to practice - error mechanism (note)
6G显卡显存不足出现CUDA Error:out of memory解决办法
Dialogue with Qiao Xinyu: the user is the product manager of Wei brand, and zero anxiety defines luxury
xpath
Selenium上传文件有多少种方式?不信你有我全!
Codeforces Round #717 (Div. 2)
How to open an account for agricultural futures? How much is the handling charge for opening an account for futures? Who can give you a preferential handling charge?
管理系统-ITclub(中)
01 golang environment construction
Structured machine learning project (I) - machine learning strategy
regular expression
Gbase 8A method for reducing the impact on the system by controlling resource usage through concurrency during node replacement of V8 version
Day 7 of "learning to go concurrent programming in 7 days" go language concurrent programming atomic atomic actual operation includes ABA problem
Go from introduction to actual combat - execute only once (note)
Yarn performance tuning of CDH cluster
對話喬心昱:用戶是魏牌的產品經理,零焦慮定義豪華
I think I should start writing my own blog.
Test birds with an annual salary of 50w+ are using this: JMeter script development -- extension function