Skip to content

3.JavaScript进阶,什么是内置类型 #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
webVueBlog opened this issue Mar 10, 2020 · 0 comments
Open

3.JavaScript进阶,什么是内置类型 #3

webVueBlog opened this issue Mar 10, 2020 · 0 comments
Labels
JavaScript JavaScript

Comments

@webVueBlog
Copy link
Member

内置类型

  1. JS中分7种内置类型,7钟内置类型又分为两大类型:基本类型和对象(Object)。
  2. 基本类型有六种,nullundefinedbooleannumberstringsymbol
  3. JS的数字类型是浮点类型,没有整形。
  4. NaN属于number类型,并且NaN不等于自身。
  5. 对于基本类型来说,如果使用字面量的方式,那么这个变量只是个字面量,只有在必要的时候才会转换为对应的类型。
let a = 10 // 这只是字面量,不是number类型
a.toString() // 使用时候才会转换为对象类型

对象(Object)是引用类型,在使用过程中会遇到浅拷贝和深拷贝的问题。

// 浅拷贝
let a = { name: 'Jeskson' }
let b = a
b.name = 'web'
console.log(a.name) // web
@webVueBlog webVueBlog added the JavaScript JavaScript label Mar 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
JavaScript JavaScript
Projects
None yet
Development

No branches or pull requests

1 participant