Created
June 2, 2013 03:09
-
-
Save IQAndreas/5692481 to your computer and use it in GitHub Desktop.
Unless I am mistaken, FireFox allows optional parameters in functions, Chrome does not.
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
<script type="text/javascript"> | |
function optional(required, optional = 5) | |
{ | |
console.log(required, optional); | |
} | |
optional("a", "b"); | |
optional("c"); | |
optional(); | |
</script> | |
/* ---------------------------------- | |
All sample outputs are on Ubuntu 13.04 (though as all browsers are cross-platform, it shouldn't matter anyway) | |
> Mozilla FireFox 21.0 | |
a b | |
c 5 | |
undefined 5 | |
> Google Chrome 27.0.1453.93 | |
Uncaught SyntaxError: Unexpected token = | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment