Skip to content

Instantly share code, notes, and snippets.

@projektorius96
Last active November 21, 2019 21:32
Show Gist options
  • Save projektorius96/40de47dd2cc43be1fee3c309f8c8f561 to your computer and use it in GitHub Desktop.
Save projektorius96/40de47dd2cc43be1fee3c309f8c8f561 to your computer and use it in GitHub Desktop.
arg1, "" where "" helps out to avoid undefined attached to in console output
var paramArr = [" love you", " when you smile"];
[arg1, arg2] = paramArr;
// [modified] const [arg1, arg2] = paramArr;
function iLoveYou (arg1, arg2) {
return arg1 + arg2;
}
iLoveYou(arg1, "");
// output: "I love you"
iLoveYou("", arg2);
// output: "when you smile"
// arg1 + arg2
// [modified] "I love you whene you smile"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment