-
-
Save juanlopezdev/1b84115f1254be8890be to your computer and use it in GitHub Desktop.
Inicializar variables en una funcion en "Javascript"
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
function myfunction(param) { | |
return (param === undefined) ? true : param; | |
} | |
/* Testing 'myfunction' in console.. | |
// Default value example | |
> myfunction(); | |
true | |
> myfunction('Hello world !'); | |
"Hello world !" | |
> myfunction(''); | |
"" | |
> myfunction(123456); | |
123456 | |
> myfunction(null); | |
null | |
> myfunction(false); | |
false | |
> myfunction(true); | |
true | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment