//возможность ECMAScript 6
function SayGoodby(message = "Goodby!") {
console.log(message);
}
SayGoodby();
//печатает "Goodby!"
SayGoodby("see you");
//печатает "see you"
//было
function OldSayGoodby(message) {
if (message == undefined) {
message = "Goodby!";
}
console.log(message);
}
OldSayGoodby();
//печатает "Goodby!"
OldSayGoodby("see you");
//печатает "see you"