- 2
ES6 Rest Parameters, What is the output of the following code?
function magic(...nums) { let sum = 0; nums.filter(n => n % 2 == 0).map(el => sum+= el); return sum; } console.log(magic(1, 2, 3, 4, 5, 6));
5 Answers
+ 6
Kniffin Haruka Why can't you? There's literally a web IDE built-in to SL. The code in question sums up all given elements which are even, so the output is 12 (2+4+6).
https://code.sololearn.com/WgQ1M7h6uG2o/?ref=app
+ 4
Run it and see.
+ 4
To do what Hatsy Rei did you can create a web code bit in the {} Code tab. Just add a new code, select web and save it ( be sure to click the public check box.) You can also tag someone to allow them access.
0
If I can, I would not ask for help here
- 1
12