From 33452150594ce7043de5818ebb79c3d55545fa63 Mon Sep 17 00:00:00 2001 From: artin-phares Date: Thu, 15 Jun 2017 23:37:17 +0300 Subject: [PATCH 1/2] fixed Function.prototype.bind polyfill --- this & object prototypes/ch2.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/this & object prototypes/ch2.md b/this & object prototypes/ch2.md index 1039120b7..a351f6793 100644 --- a/this & object prototypes/ch2.md +++ b/this & object prototypes/ch2.md @@ -536,10 +536,7 @@ if (!Function.prototype.bind) { fNOP = function(){}, fBound = function(){ return fToBind.apply( - ( - this instanceof fNOP && - oThis ? this : oThis - ), + this instanceof fNOP ? this : oThis, aArgs.concat( Array.prototype.slice.call( arguments ) ) ); } From d71ecd8cfe5d47779c87e9d3d35fb6498c820e47 Mon Sep 17 00:00:00 2001 From: artin-phares Date: Thu, 15 Jun 2017 23:50:44 +0300 Subject: [PATCH 2/2] fixed subsequent copy of Function.prototype.bind example --- this & object prototypes/ch2.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/this & object prototypes/ch2.md b/this & object prototypes/ch2.md index a351f6793..00aac5a7a 100644 --- a/this & object prototypes/ch2.md +++ b/this & object prototypes/ch2.md @@ -555,8 +555,7 @@ if (!Function.prototype.bind) { The part that's allowing `new` overriding is: ```js -this instanceof fNOP && -oThis ? this : oThis +this instanceof fNOP ? this : oThis // ... and: