#7DaysJS: myElement + n
Lautaro Lobo

Lautaro Lobo @lautarolobo

About: While you read this I'm learning something new.

Location:
Córdoba, Argentina
Joined:
May 6, 2019

#7DaysJS: myElement + n

Publish Date: Dec 4 '19
6 0

Welcome to day 6 of 7 Days of JavaScript!

Let’s see, I got a nice one for today.

Given an array and a number n, return the array with each element summed to n.

Here’s an example:

sumToArray(5,[1,2,3,4])
...
[6,7,8,9]
Enter fullscreen mode Exit fullscreen mode

If you want, you can also return the output as a string - If that makes it easier for you, it’s OK.

You can check out the solution algorithm here.

Comments 0 total

    Add comment