call, apply, bind

Call

function a(){
    console.log('a');
}

// These two are the same
a() === a.call()

Questions

var b = {
    name: 'jay'
    say(): {
        console.log(this)
    }
}

var c = {
    name: 'jay'
    say(): {
        return function() {
            console.log(this)
        }
    }
}

var d = {
    name: 'jay'
    say(): {
        return () => console.log(this)
    }
}

// What would each return?
b.say() 

c.say()()

d.say()()

Last updated