0

ES6 Rest parameters. Please explain me the code line by line. Thanks in advanced.

function containsAll(arr) { for (let k = 1; k < arguments.length; k++) { let num = arguments[k]; if (arr.indexOf(num) === -1) { return false; } } return true; } let x = [2, 4, 6, 7]; console.log(containsAll(x, 2, 4, 7)); console.log(containsAll(x, 6, 4, 9));

5th Feb 2019, 5:47 PM
Tapas Mondal
Tapas Mondal - avatar
1 Answer
0
Specially checking of -1 and the output it gives.
5th Feb 2019, 5:50 PM
Tapas Mondal
Tapas Mondal - avatar