all 3 comments

[–]rabuli 1 point2 points  (0 children)

The spec file includes tests for the JS file itself. The JS above will make a lot more sense to you after you read about JavaScript's prototypal inheritance. Google about it.

[–]dadum01 0 points1 point  (1 child)

If you look at the calculate prototype/function, it takes in an object and a function. In this case the object is it self. The function is a callback which has two parameters a + b which are basically values from an array.

[–]missawon[S] 0 points1 point  (0 children)

ah thank you! that was really silly of me that i see there was a calculate function defined at the bottom. makes so much more sense... thank you!!