r/javascript • • Dec 16 '18

Coming from Python to JS NSFW

const print = console.log

I found my safe space.

607 Upvotes

156 comments sorted by

View all comments

20

u/Capaj Dec 16 '18

you can go even further: global.print = console.log even though it's probably not the best idea to pollute your global ;-)

10

u/[deleted] Dec 16 '18

...where is the global?

19

u/joelangeway Dec 16 '18

Iirc that works in node.js like window works in the browser, in that it’s synonymous with the global scope.

1

u/baubleglue Dec 17 '18

global || global = window;