Skip to content

Instantly share code, notes, and snippets.

@deleteman
Last active August 31, 2020 09:42
Show Gist options
  • Save deleteman/0a2868f922bb91cd4c5dd4bb8fed9b50 to your computer and use it in GitHub Desktop.
Save deleteman/0a2868f922bb91cd4c5dd4bb8fed9b50 to your computer and use it in GitHub Desktop.
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"
@deleteman
Copy link
Author

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