0

Following code gives the output {name:'xyz'}. How do we know what this points to when both call and bind are used?

var factoryFunc = function() {
    console.log(this);
}.bind({
    'name': 'xyz'
})

factoryFunc.call({
    'name': 'abc'
})
Tushar
  • 82,599
  • 19
  • 151
  • 169
john doe
  • 786
  • 1
  • 12
  • 28

1 Answers1

0

A bound function will have its this value immutable. So in your case the XYZ object will be pointed.

I will update this answer when I get to my pc

PSWai
  • 1,168
  • 13
  • 32