I am trying to understand arrow functions in ECMAScript 6.
This is the definition I came across while reading:
Arrow functions have implicit
thisbinding, which means that the value of thethisvalue inside of an arrow function is aways the same as the value ofthisin the scope in which the arrow function is defined!
According to the definition, I believe this for an arrow function should contain the same block level values that the arrow function was defined in.
Code:
var test = {
  id: "123123",
  k: {
    laptop: "ramen",
    testfunc: () => console.log(this)
  }
}
console.log(test.k.testfunc);
However, I am getting this result from the code
function testfunc() {
    return console.log(undefined);
}
What I thought I would get would be an output of:
{"laptop": "ramen"}
if I ran this
console.log(test.k.testfunc());
 
     
     
    