Skip to content
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

我要懂系列-基本类型和引用类型 #27

Open
shaodahong opened this issue Feb 26, 2020 · 0 comments
Open

我要懂系列-基本类型和引用类型 #27

shaodahong opened this issue Feb 26, 2020 · 0 comments

Comments

@shaodahong
Copy link
Owner

shaodahong commented Feb 26, 2020

前言

回头来看基础总会有不一样的感受,所以弄了个系列记录下,这篇算是起点,共勉

JS 是门弱类型语言,包含两种类型

  • 基本类型
  • 引用类型

先来说说基本类型,基本类型包含

  • string
  • number
  • boolean
  • undefined
  • null
  • symbol
  • bigint

引用类型包含

  • object
  • function
  • array
  • map
  • set

基本类型也叫简单类型或者值类型,我们可以使用 typeof 来得到它的类型

typeof '1'
// "string"

typeof 1
// "number"

typeof true
// "boolean"

typeof undefined
// "undefined"

typeof null
// "object"

typeof Symbol()
// "symbol"

typeof 1n
// "bigint"
@shaodahong shaodahong changed the title 基本类型和引用类型 我要懂系列-基本类型和引用类型 Feb 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant