Module4: Constructing Rest Parameters
parent
368314fcdd
commit
d822050bdc
8
app.js
8
app.js
|
@ -1,5 +1,5 @@
|
|||
function sayHi(message, name = 'World') {
|
||||
console.log(message + " " + name);
|
||||
function greet(...names, message) { // SyntaxError generated
|
||||
console.log(message + ' everyone!');
|
||||
names.forEach(name => console.log('Hi ' + name));
|
||||
}
|
||||
sayHi("Hello");
|
||||
sayHi("Hi", 'John');
|
||||
greet('Welcome', 'Mary', 'John', 'James');
|
Loading…
Reference in New Issue