Skip to content

Instantly share code, notes, and snippets.

@amar9312
Forked from deleteman/nullish2.js
Created August 25, 2020 01:17
Show Gist options
  • Save amar9312/5d913228458ee5e846fa2b8d0dce1711 to your computer and use it in GitHub Desktop.
Save amar9312/5d913228458ee5e846fa2b8d0dce1711 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"
@amar9312
Copy link
Author

myFn is debugged now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment