Module4: Using the Spread Operator

master
jason.zhu 2021-05-13 15:14:05 +10:00
parent d822050bdc
commit 2a5ef56d42
1 changed files with 5 additions and 4 deletions

9
app.js
View File

@ -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);