Module4: Constructing Rest Parameters

master
jason.zhu 2021-05-13 15:03:13 +10:00
parent 368314fcdd
commit d822050bdc
1 changed files with 4 additions and 4 deletions

8
app.js
View File

@ -1,5 +1,5 @@
function sayHi(message, name = 'World') { function greet(...names, message) { // SyntaxError generated
console.log(message + " " + name); console.log(message + ' everyone!');
names.forEach(name => console.log('Hi ' + name));
} }
sayHi("Hello"); greet('Welcome', 'Mary', 'John', 'James');
sayHi("Hi", 'John');