egoist / codepan

Like codepen and jsbin but works offline.
https://codepan.egoist.sh
MIT License
1.18k stars 178 forks source link

I feel confused about the codepan running result #68

Closed johnsoncheg closed 5 years ago

johnsoncheg commented 5 years ago

Issuehunt badges

codepan demo:

var a = 1;
console.log(this.a) // undefined

jsbin&codepen demo:

var a = 1
console.log(this.a) // 1

judge from the result above, I think something has gone wrong with codepan's code. I guess it may has something to do with the strict mode


IssueHunt Summary #### [stroncium stroncium](https://issuehunt.io/u/stroncium) has been rewarded. ### Sponsors (Total: $100.00) - [issuehunt issuehunt](https://issuehunt.io/u/issuehunt) ($100.00) ### Tips - Checkout the [Issuehunt explorer](https://issuehunt.io/r/egoist/codepan/) to discover more funded issues. - Need some help from other developers? [Add your repositories](https://issuehunt.io/r/new) on IssueHunt to raise funds.
johnsoncheg commented 5 years ago

When I print the window Object, the console panel show [Object window], it seems that the code executed is isolated from the page window Object unless I manually assign window.a = 1

IssueHuntBot commented 5 years ago

@issuehunt has funded $100.00 to this issue.


issuehunt-oss[bot] commented 5 years ago

@egoist has rewarded $70.00 to @stroncium. See it on IssueHunt