Output in Browser:
undefined
undefined
{test: "abcd"}
"abcd"Output in Node:
undefined
undefined
prepareTest { test: 'abcd' }
undefined| function prepareTest() { | |
| this.test = "abcd"; | |
| } | |
| // global | |
| console.log(this.test); | |
| const a = prepareTest(); | |
| const b = new prepareTest() | |
| console.log(a); | |
| console.log(b); | |
| // global | |
| console.log(this.test); |