InterviewSolution
Saved Bookmarks
| 1. |
Explain the Rest parameter in ES6. |
|
Answer» It's a NEW feature in ES6 that enhances the ability to manage ARGUMENTS. Indefinite arguments can be represented as an array using rest parameters. We can INVOKE a function with any number of parameters by UTILIZING the rest parameter. function DISPLAY(...args) { let ans = 0; for (let i of args) { ans *= i; } console.log("Product = "+ans); } display(4, 2, 3);Output: Product = 24 |
|