Last active
July 29, 2017 09:58
-
-
Save boopathi/721228f8c136029bb1142aee29a20199 to your computer and use it in GitHub Desktop.
Revisions
-
boopathi revised this gist
Jul 29, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,7 +3,7 @@ class A { #x; constructor(x, a) { #x = x; this.foo = this.foo.bind(a); } foo() { console.log(this?.#x); // optional chaining -
boopathi revised this gist
Jul 29, 2017 . 1 changed file with 11 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,15 +1,21 @@ ```js class A { #x; constructor(x, a) { #x = x; this.foo = this.foo.bind(a); // binds to undefined } foo() { console.log(this?.#x); // optional chaining // Possible to use optional chaining? // And this.#x and #x refer to same thing? console.log(#x); } } const p = new A(10); const q = new A(20, foo); p.foo(); q.foo(); ``` -
boopathi revised this gist
Jul 29, 2017 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,9 +1,9 @@ ```js class A { #x; constructor(x, a = this) { #x = x; this.foo = this.foo.bind(a); } foo() { console.log(#x, this.#x); // ? -
boopathi revised this gist
Jul 29, 2017 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,15 +1,15 @@ ```js class A { #x; constructor(x, a) { #x = x; this.foo = this.foo.bind(a || this); } foo() { console.log(#x, this.#x); // ? } } const a = new A(20, new A(10)); a.foo(); // ? ``` -
boopathi revised this gist
Jul 29, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ class A { #x; constructor(x) { #x = x; this.foo = this.foo.bind(new A(10)); } foo() { -
boopathi created this gist
Jul 29, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ ```js class A { #x; constructor(x) { this.#x = x; this.foo = this.foo.bind(new A(10)); } foo() { console.log(#x, this.#x); // ? } } const a = new A(20); a.foo(); // ? ```