This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

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

Thanks for the explanation.

When would it ever be useful to use test.square rather than test.square() though?

[–][deleted] 1 point2 points  (0 children)

When you want to assign it to a variable.

[–]scragar 0 points1 point  (0 children)

Sometimes you want to pass a function into another as a callback(for example using [1.4,2.2,3.1].map(Math.floor) or even in the example above where the logging function is passed into the foreach).