Skip to content

Latest commit

 

History

History
15 lines (10 loc) · 834 Bytes

Sum with Arrows.md

File metadata and controls

15 lines (10 loc) · 834 Bytes

Description:

Sum all the values in an array using Arrow style function Task Your task is to complete the function in the string to Sum all the numbers in an array using the Arrow style function NOTE:

Because eval hasnt caught up and cannot evaluate arrow style functions I have to do it manually. Your solution must contain the Arrow style function, the curly braces inside the reduce and the return statement because it must be manually converted to an old function style to test the validlity of the function itself. Your function will be returned to you when it is converted incase it fails (which is highly possible) if any issues occur please post in the discussion and provide your solution marked as spoiler, Thanks

Solution:

var Sum = 'sum = function(arr){ return arr.reduce((a,b) => a+b,0); }';