js 堆栈
js 细节
- aert() // obj.toString()
- VO 创建值
- VO 指针指向值(val,16 进制堆地址)
- let VO
- var GO
- GO 全局对象
- VO 变量对象
- AO 活动对象
- ECStack 执行上下文
- scope 作用域
- scope chain 作用域链
js 闭包
- js
- es6/es7/es9
- h5/css3
- vue
- 小程序
es7
['a', 'b', 'c'].includes('a')
['a', 'b', 'c', 'd'].includes('b', 2)
[1, +0, 3, 4].includes(-0)
[1, +0, 3, 4].indexOf(-0)
var arr = [1, [2, 3], 4]
arr.includes([2, 3])
arr.indexOf([2, 3])
let demo = [1, NaN, 2, 3]
demo.indexOf(NaN)
demo.includes(NaN)
es8
3 ** 2
Math.pow(3, 2)
let timer = async function timer() {
return new Promise((reslove, reject) => {
setTimeout(() => {
reslove('a');
}, 1000);
})
}
timer().then(result => {
console.log(result);
}).catch(err => {
console.log(err.message);
})
let promise = new Promise((reslove, reject) => {
throw new Error('promise使用Error抛出异常')
})
promise().then(res => {
console.log(res)
}).catch(err => {
console.log(err.message)
})
let promise = new Promise((resolve, reject) => {
setTimeout(() => {
reject(new Error('promise抛出异常'));
}, 1000);
})
promise.then(res => {
console.log(res);
}).catch(err => {
console.log(err.message);
})
let sayHello = async function sayHello() {
let hi = 'hello world'
return hi
}
sayHello().then(res => {
console.log(res)
}).catch(err => {
console.log(err.message);
})
js 引擎