The transition from Ruby on Rails to JavaScript was not as bad as I thought it would be. In fact, they share a lot of similarities. For one, functions was very similar to Ruby’s methods. Though there are some core differences that I’d like to discuss about JavaScript’s functions.

Referencing a Function

In Ruby we can call a method by writing its name. If we do so in ruby, we are only referencing the function’s definition. For example:

I defined a function and then console logged the function as a reference without using the invoking () operator. This console log was only the function’s definition, nothing inside the function actually ran.

#flatiron-school #javascript

JavaScript: Invoking, Referencing and Callback Functions Explained
1.90 GEEK