Message from JavaScript discussions

November 2018

— a is normal, and we talk about arrow function test

— 

var test = function() {
this.a = (function(me) {
return function() {
return me;
}
})(this);;
this.b = (() => this);
};

var test = new test();
var a = test.a;
var b = test.b;

if (test.a() === b() && test.b() === a() && a() === b()) {
console.log('It is bound!!!!!!!!!!!');
}

— Language:

js


Source:
var test = function() {
this.a = (function(me) {
return function() {
return me;
}
})(this);;
this.b = (() => this);
};

var test = new test();
var a = test.a;
var b = test.b;

if (test.a() === b() && test.b() ===


Errors:
source_file.js:15
});
^

SyntaxError: Unexpected token }
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:374:25)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Function.Module.runMain (module.js:442:10)
at startup (node.js:136:18)
at node.js:966:3

Message permanent page

— 🤣

— Https://jsperf.com/normal-bound-vs-arrow-create-speed/1

— So what's the problem?

— Afs have lexical this

— Js is not intepreted

— Is compiled

— Af are bound at lexical time

— For more information, study you don't know js series 😃

— Terminology is a problem