But does it also prevent bind() from working?
Partially, because bind
returns a new function that calls the original function with a specific this
— but arrow functions don't use the this
they're called with, they completely ignore it. Instead, they close over the this
where they're defined.
bind
on an arrow function can't change the arrow's concept of this
. All it can do is its secondary feature, pre-supplying arguments:
"use strict";
function run() {
const f = (a, b, c) => {
console.log("this", this);
console.log("a", a);
console.log("b", b);
console.log("c", c);
};
const fbound = f.bind({}, 1, 2, 3);
f();
fbound();
}
run();
.as-console-wrapper {
max-height: 100% !important;£
}
I'm building a filter sidebar for my site, I want to be able to open and close the filter lists by pressing a btn. jQuery('.parent > .children').parent().click(function() { jQuery(this)....
I'm building a filter sidebar for my site, I want to be able to open and close the filter lists by pressing a btn. jQuery('.parent > .children').parent().click(function() { jQuery(this)....
Is it possible to create a coverage report with jest for files that satisfy a wildcard path? After the latest release of jest, I can finally create coverage for files specified in the "...
Is it possible to create a coverage report with jest for files that satisfy a wildcard path? After the latest release of jest, I can finally create coverage for files specified in the "...
I have cookie value stored in following format {stamp:'HMzWoJn8V4ZkdRN1DduMHLhS3dKiDDr6VoXCjjeuDMO2w6V+n2CcOg==',necessary:true,preferences:true,statistics:true,marketing:false,ver:1} and i need ...
I have cookie value stored in following format {stamp:'HMzWoJn8V4ZkdRN1DduMHLhS3dKiDDr6VoXCjjeuDMO2w6V+n2CcOg==',necessary:true,preferences:true,statistics:true,marketing:false,ver:1} and i need ...
Here's my plunker. If you click on the profile link and look at the generated state change list: stateChanges = [ " -> home", "home -> profile", "home -> signIn", "signIn -> ...
Here's my plunker. If you click on the profile link and look at the generated state change list: stateChanges = [ " -> home", "home -> profile", "home -> signIn", "signIn -> ...