Skip to content

Instantly share code, notes, and snippets.

@fedesoria
Created June 19, 2012 05:05
Show Gist options
  • Save fedesoria/2952399 to your computer and use it in GitHub Desktop.
Save fedesoria/2952399 to your computer and use it in GitHub Desktop.
window variables
window.variable = "foo"
en vez de
variable = "foo"
y asi lo puedes llamar desde donde sea como
window.variable
@fedesoria
Copy link
Author

If you'd like to create top-level variables for other scripts to use, attach them as properties on window, or on the exports object in CommonJS. The existential operator (covered below), gives you a reliable way to figure out where to add them; if you're targeting both CommonJS and the browser: exports ? this

-- http://coffeescript.org/#lexical_scope

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment