箭头函数(es6)

let person=()=>{
    console.log("大家好")
}

person()

let person(..args)=>{
    console.log(args)
}

高阶函数

function person(){
    return function(wrap){
        return function(prop){
            console.log(wrap,prop)
        }
    }
}

let person=()=>wrap=>prop=>{
    console.log(wrap,prop)
}

person()('我是wrap')('我是prop')
var person={
    name:"张三",
    getName:function(){
        setTimeout(()=>{
            console.log(this)
            console.log(this.name)
        },300)
    }
}

var getName=person.getName.bind(person)
getName()

猜你喜欢

转载自blog.csdn.net/qq_26798533/article/details/119489311
今日推荐