5 ms·
Now that both ?= and or= throw errors with an undefined variable, is there another idiomatic way to write Ruby's ||= in CoffeeScript?
by telemachos 15y ago
Now that both ?= and or= throw errors with an undefined variable, is there another idiomatic way to write Ruby's ||= in CoffeeScript?
- jashkenas 15y agoIf you want the previous global behavior (make sure you're on 1.3.1) ... explicitly say you're making a global: window._ or= require "underscore"
- telemachos 15y agoThanks.
- wc7 15y agoI am not sure if this directly addresses your issue or not, but check out this reply to the article (1.3.1 just released to fix a problem undeclared globals and or= ) http://news.ycombinator.org/item?id=3824543 http://news.ycombinator.org/item?id=3824543