es6-11
let
const
解构赋值
模板字符串 `${}`
对象简写
箭头函数
函数参数默认值
...扩展运算符
class
promiss
Map
proxy
async
aweit
import动态引入
function a(name="ya",age="19"){}
let data= {
a:1,
b:2,
c:3,
d:4,
}
let { a, ...v } = data
console.log(v)
??""
console.log(undefined??"")
console.log(null??"")
console.log(2??"")
console.log(true??"")

Event Loop
js单线程
微任务:promiss
宏任务:js主体,setTimeOut,setInteval
内存管理机制
新生代 复制->删除 超过25%-->老生代
老生代 标记->清除->整理
内存分区
堆:引用类型 Object Array 先进先出
栈:基本数据类型 先进后出
池:const常量
继承
function Parent(name){
this.name = name
}
function Child(name){
this.name = name
}
Child.prototype = new Parent()
Child.prototype.constructor = Child
缺点:多个子类实例指向同一个原型,修改会一起改
function Child(){
Parent.call(this,"小李")
}
缺点:只能继承父类内部方法属性,没法继承父类原型的属性
function Child(){
Parent.call(this,"小李")
}
Child.prototype = new Parent()
Child.prototype.constructor = Child
缺点:每次生成子类实例,就会多次执行父类构造函数
Child.prototype = Parent.prototype
Child.propotype.constructor = Child
function Child(){
Parent.call(this,"小王")
}

Child.prototype = Object.create(Parent.prototype)
Child.propotype.constructor = Child
function Child(){
Parent.call(this,"小王")
}
原型图
蓝色线即为原型链

js是词法作用域不是动态作用域