es6 · ES6 Basics
Rest is a new way for functions to handle an arbitrary number of parameters. Can you guess what the mysterious "a" variable holds?
function mystery(...params) {
return params;
}
let a = mystery(1,23,4);Answers
- "a" is undefined
- "a" becomes [1,23,4]
- "a" becomes "1 23 4"
- "a" becomes 1 23 4