Wasn't sure where to post this. Weird example in JS functions lesson?

The functions portion of the JS course gives an example of a function:

const sumNumbers = number => number + number

Not trying to be super nitpicky, but wouldn’t this just return the single parameter number you feed it, added to itself? Wouldn’t a sumNumbers function need 2 parameters at least to be true to it’s name and actually sum numbers? Wouldn’t the function in the example be more aptly named twoN or something along those lines?

The example in question is at the bottom of this screenshot:


Agreed i would call it numTimesTwo since that is exactly what is happening in this function.


Keep in mind this example is not to show some logical function but to show how a function can be written in different forms… :wink:


Fair enough hehe, I was just making certain I wasn’t thinking of arguments in the wrong way :sweat_smile:

1 Like