Coder Social home page Coder Social logo

Comments (4)

artdong avatar artdong commented on May 15, 2024

JS有 5 种基本数据类型(原始类型),即 Undefined、Null、Boolean、Number 和 String。

Undefined 类型只有一个值,即 undefined。
Null 类型只有一个专用值 null,即它的字面量。
Boolean 类型有两个值 true 和 false (即两个 Boolean 字面量)。
Number 类型既可以表示 32 位的整数,还可以表示 64 位的浮点数。安全整数范围为 -(253 - 1)到 253 - 1 之间的整数。
String 类型的字符串字面量是由双引号(")或单引号(')声明的。

from fe-interview.

alonesuperman avatar alonesuperman commented on May 15, 2024

Symbol
BigInt

see mdn for detail

from fe-interview.

artdong avatar artdong commented on May 15, 2024

JS 7 种基本数据类型(原始类型),即 (Undefined、Null、Boolean、Number 、String) + (Symbol、BigInt)和 3种引用数据类型:对象(Object)、数组(Array)、函数(Function)。

基本类型值:指的是保存在栈内存中的简单数据段。

引用类型值:指的是那些保存在堆内存中的对象。变量中保存的实际上只是一个指针,这个指针指向内存堆中实际的值。

注:Symbol 是 ES6 引入了一种新的原始数据类型,表示独一无二的值; BigInt即是第七种基本类型,V8引擎v6.7 默认启用对 BigInt 的支持。

Symbol用法

语法

Symbol (value)

eg.

let a=Symbol ("welcome");
console.log(a); //输出 Symbol(welcome)

BigInt用法

语法

BigInt(value) || 数字后面加n;

eg.

let b1 = BigInt(10);
let b2 = 10n;
console.log(b1,b2); //输出 10n 10n

from fe-interview.

my-code-store avatar my-code-store commented on May 15, 2024

es6一共7种数据类型
Number:表示32位的整数和64位的浮点数
Undefined:只有一个值是Undefined
String:字符串类型
Boolean:有true和false两个值
Symbol:创建一个唯一的值Symbol('test') === Symbol('test')的结果是false
BigInt:当数值的大小超过最大安全数时,无法判断数值的小,BigInt可以解决,只需在数值后加'n'就可以了例如:9009999999999999229 == 9009999999999999329 结果是true;9009999999999999229n == 9009999999999999329n 结果是false

from fe-interview.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.