This file contains 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 characters
class Foo { | |
constructor() { | |
this._va = 0 | |
} | |
} | |
/** | |
* Fooクラスを取得する | |
* @return {Foo} - Fooクラス | |
*/ |
This file contains 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 characters
class Foo { | |
constructor() { | |
} | |
} | |
function foo() { return Foo } // クラスを取得する |
This file contains 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 characters
const foo = Lib.foo() // 「Foo#constructor()」が出力される | |
foo.hoge() // 「Foo#hoge()」が出力される |
This file contains 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 characters
class Foo { | |
constructor() { | |
console.log('Foo#constructor()') | |
} | |
hoge() { | |
console.log('Foo#hoge()') | |
return true | |
} | |
} |
This file contains 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 characters
const Foo = Lib.foo() // クラスをlocal globalな定数に入れてしまう | |
function myFunction() { | |
const foo = new Foo() // 「Foo#constructor()」が出力される | |
foo.hoge() // 「Foo#hoge()」が出力される | |
} |
This file contains 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 characters
function myFunction() { | |
const foo = new (Lib.foo())() // 「Foo#constructor()」が出力される | |
foo.hoge() // 「Foo#hoge()」が出力される | |
} |
This file contains 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 characters
class Foo { | |
constructor() { | |
console.log('Foo#constructor()') | |
} | |
hoge() { | |
console.log('Foo#hoge()') | |
return true | |
} | |
} |
This file contains 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 characters
function myFunction() { | |
const foo = new Lib.foo() // 「Foo#constructor()」が出力される | |
foo.hoge() // 「Foo#hoge()」が出力される | |
} |
This file contains 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 characters
class Foo { | |
constructor() { | |
console.log('Foo#constructor()') | |
} | |
hoge() { | |
console.log('Foo#hoge()') | |
return true | |
} | |
} |
This file contains 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 characters
function test() { | |
console.log(this.a) // 1 | |
console.log(this.b) // 2 | |
console.log(this.c) // undefined | |
console.log(this.d) // undefined | |
console.log(this.e()) // 5 | |
console.log(a) // 1 | |
console.log(b) // 2 | |
console.log(c) // 3 |