Rest is a new way for functions to handle an arbitrary number of parameters. Can you guess what the mysterious "a" variable holds?

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

“a” is undefined
“a” becomes [1,23,4]
“a” becomes “1 23 4”
“a” becomes 1 23 4

the correct ans is a=[1,23,4]

1 Like