Answers for "describe the most important difference between arrow functions and the function keyword when writing functions in js."

0

why can't you use arrow function with this in javascript for declaring methods

'use strict';

var obj = { // does not create a new scope
  i: 10,
  b: () => console.log(this.i, this),
  c: function() {
    console.log(this.i, this);
  }
}

obj.b(); // prints undefined, Window {...} (or the global object)
obj.c()
Posted by: Guest on July-16-2021

Code answers related to "describe the most important difference between arrow functions and the function keyword when writing functions in js."

Code answers related to "Javascript"

Browse Popular Code Answers by Language