Giter Club home page Giter Club logo

Comments (1)

Sukiey avatar Sukiey commented on September 2, 2024

引用类型

除了 6 种原始值类型之外,其余的都是引用类型,统称为 对象类型。

  • 引用类型的值是按引用访问的。
  • 引用类型的值是保存在内存中的复杂数据。

更多关于 ECMScript 规范内容

按引用访问

  • 引用类型的数据在内存中的存储方式与原始值类型的数据不同,它的值被保存在堆内存中,而栈内存中存储的是指向堆内存的存储位置(指针)。
  • 在访问引用类型数据时,拿到的其实是指向真实数据的指针。

创建对象的两种方式

  1. 字面量,是对象定义的一种简写形式
  2. 构造函数

引用类型有哪些

ECMScript 规范中定义了很多内置的对象,细分的话包括:

  • Object
  • Function,
  • String, Boolean, Number
  • Array, Map, Set
  • Date, RegExp, Math, Error, JSON, Promise 等等

更多内置对象

Object 类型

Object 是一个特殊的对象,它本身是一个顶级对象(在原型链的顶端),同时还是一个构造函数,可以通过它(new Object())来创建一个对象。

Function 类型

每个 JavaScript 函数实际上都是一个 Function 对象。运行 (function(){}).constructor === Function // true 便可以得到这个结论。

from salvation.

Related Issues (6)

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.