js基础知识整理

119 阅读1分钟

es6

  • getter setter
class Person{
    constructor(name,word){
        this.name = name
        this.word = word
    }   
   //在读取值和赋值的时候调用
    set change(name){
        this._name = name
    }
    get change(){
        return this._name.toUpperCase
    }
}

arguments

  • es5把参数数组化:[].slice.call(arguments,1),这段代码让arguments可以用slice方法
  • es6用扩展运算符

node

  • port = process.env.PORT || 3030
  • 热更新 nodemon

string常用方法

array常用方法