Last active
August 31, 2020 09:42
-
-
Save deleteman/0a2868f922bb91cd4c5dd4bb8fed9b50 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
function myFn(variable1, variable2) { | |
variable2 ??= "default value" | |
return variable1 + variable2 | |
} | |
myFn("this has", " no default value") //returns "this has no default value" | |
myFn("this has no") //returns "this has no default value" | |
myFn("this has no", 0) //returns "this has no 0" |
Please, change var2 for variable2, cause the var2 doesn’t exist.
thanks @damianpumar, good catch! I've updated the code.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This function is debugged, please check my fork