Comments (1)
引用类型
除了 6 种原始值类型之外,其余的都是引用类型,统称为 对象类型。
- 引用类型的值是按引用访问的。
- 引用类型的值是保存在堆内存中的复杂数据。
按引用访问
- 引用类型的数据在内存中的存储方式与原始值类型的数据不同,它的值被保存在堆内存中,而栈内存中存储的是指向堆内存的存储位置(指针)。
- 在访问引用类型数据时,拿到的其实是指向真实数据的指针。
创建对象的两种方式
- 字面量,是对象定义的一种简写形式
- 构造函数
引用类型有哪些
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from salvation.