Answers for "difference between arrow functions and function expression"

1

difference between arrow functions and function expression

var obj1 = {
  valueOfThis: function(){
    return this;
  }
}
var obj2 = {
  valueOfThis: ()=>{
    return this;
  }
}

obj1.valueOfThis(); // Will return the object obj1
obj2.valueOfThis(); // Will return window/global object
Posted by: Guest on June-17-2021

Code answers related to "difference between arrow functions and function expression"

Browse Popular Code Answers by Language