Created
May 23, 2015 21:30
-
-
Save mbuttler/8b766143d579ccc10fd1 to your computer and use it in GitHub Desktop.
This file contains 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
var isEven = function(number) { | |
// Your code goes here! | |
if (number % 2 === 0) | |
return true; | |
else | |
return false; | |
}; |
You don't need curly braces if anything after the if
and else
is in a single line :)
You'll need curly braces if you need multiple lines.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/if...else
http://stackoverflow.com/questions/7117873/do-if-statements-in-javascript-require-curly-braces
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Why is this syntactically valid? Shouldn't curly braces be required?