JS Data type of
mention JS Data type of , This should be JS The most basic knowledge of , But many beginners may not be clear JS What are the data types , Or it's not comprehensive enough , Some people say there is 6 Type of data , Some people say there is 7 Kind of . Today I want to summarize JS Data type of , I hope it can be helpful for beginners .
Question 1 :
JS Which types of data can be divided into ?
answer :
JS There are two types of data :1. Basic data type ,2. Reference data type
Question two :
JS How many data types are there , What kind of ?
answer :
stay ES5 When , The data types are 6 Kind of ( This is also the initial cognition of beginners ):
Basic data type :String、Number、Boolean、Undefined、Null(5 Kind of )
Reference data type :Object
But according to the latest standards
JS There are a total of 8 Kind of , They are
Basic number data type :String、Number、Boolean、Undefined、Null、Symbol(ES6 newly added )、BigInt(ES2020 newly added )
Reference data type :Object
among ,
Symbol yes ES6 A new data type , To put it simply : It is used to represent unique values
and bigint( Large integer ) yes ES2020 A new data type introduced , This is a ECMAScript The eighth data type .BigInt It's only used to represent integers , There is no limit to the number of digits , An integer of any number of digits can be expressed exactly .