Skip to content

Instantly share code, notes, and snippets.

@clutchski
Created February 7, 2012 16:06
Show Gist options
  • Save clutchski/1760428 to your computer and use it in GitHub Desktop.
Save clutchski/1760428 to your computer and use it in GitHub Desktop.
compiled if expressions
# This CoffeeScript compiles to ...
x = if 'a' in [1, 2, 3, 4]
1
else if 'b' in [1, 2, 3, 4, 5]
2
else if 'c' > 'd'
3
else
4
# This Javascript ...
(function() {
var x;
x = 'a' === 1 || 'a' === 2 || 'a' === 3 || 'a' === 4 ? 1 : 'b' === 1 || 'b' === 2 || 'b' === 3 || 'b' === 4 || 'b' === 5 ? 2 : 'c' > 'd' ? 3 : 4;
}).call(this);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment