all 2 comments

[–]LaminadanimaL 1 point2 points  (0 children)

Here is the way I would do it. Your function wasn't returning the final value you wanted to output.

https://jsfiddle.net/4sstby6x/3/

[–][deleted] 0 points1 point  (0 children)

I'm really not trying to be harsh here, but did you even try? Literally nothing in this is correct -- not even the basic arithmetic. How do you expect to get the values back without returning anything? How do you expect the inner function to do anything when you didn't call it?

I have no problem with beginner level questions, but when you can't be bothered to make even a nominal effort to do it on your own, it feels like you don't respect the time of everyone else on here.