Question 36
Question
Answer
function greet(name = "World", ...greetings) {
console.log(`Hello ${name}!`);
for (const greeting of greetings) {
console.log(`${greeting}`);
}
}
greet(); // Output: Hello World!
greet("Alice", "Nice to meet you", "How are you?"); // Output: Hello Alice!
// Nice to meet you
// How are you?
greet("Bob", "Hi there"); // Output: Hello Bob!
// Hi thereLast updated