nectarjs
Version:
Javascript's God Mode. No VM. No Bytecode. No GC. Just native binaries.
19 lines (16 loc) • 438 B
JavaScript
/*
Example from MDN web docs
Link: https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Objets_globaux/Function/bind
*/
var module = {
x: 42,
getX: function() {
return this.x;
}
};
const unboundGetX = module.getX;
console.log(unboundGetX()); // The function gets invoked at the global scope
// expected output: undefined
const boundGetX = unboundGetX.bind(module);
console.log(boundGetX());
// expected output: 42