Module4: Constructing Rest Parameters
parent
368314fcdd
commit
d822050bdc
8
app.js
8
app.js
|
@ -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');
|
|
Loading…
Reference in New Issue