Created
December 12, 2011 13:21
-
-
Save hojberg/1467112 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
host[model.isNew() ? "destroy" : "render"](); | |
// vs | |
if (model.isNew()) host.destroy(); | |
else host.render(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To be honest I usually write the first one, but I try to wrap it in its own method. For instance, I'd never go around writing
widget[boolean ? 'show' : 'hide']()
, I'll always try to write atoggle()
method.