Module4: Using the Spread Operator
parent
d822050bdc
commit
2a5ef56d42
9
app.js
9
app.js
|
@ -1,5 +1,6 @@
|
|||
function greet(...names, message) { // SyntaxError generated
|
||||
console.log(message + ' everyone!');
|
||||
names.forEach(name => console.log('Hi ' + name));
|
||||
function display(char1, char2, char3, char4, ...others) {
|
||||
console.log(others);
|
||||
console.log(char1, char2, char3, char4);
|
||||
}
|
||||
greet('Welcome', 'Mary', 'John', 'James');
|
||||
let letters = 'abcdefgh';
|
||||
display(...letters);
|
Loading…
Reference in New Issue