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
  • 85,780
  • 21
  • 159
  • 179
john doe
  • 806
  • 3
  • 14
  • 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,198
  • 13
  • 32