Method or Function?!?!(Ahhhhh)

Will Gonzalez
2 min readOct 14, 2020

Transitioning from ruby to javaScript, specially in a bootcamp program can seem like the weight of the whole entire world is on your shoulders. Having just gotten used to and understanding what is going on in the MVC world, jumping from folder to folder, to now having one folder and jumping back and forth with different functions can be a lot to take in.

Let’s start off with transitioning from ruby methods to JS functions. Methods and functions are the same thing . They are just two different ways to say a function (or method). Even though they are the same thing remembering how to define them is challenging when you go from ruby to JS(and vice versa). Myself I went from ruby to JS, so when writing a function I would either write ‘def’ at the front of the function or forget the Curly Braces after the function name.

I myself find that writing a JS function is a bit more complex than a ruby method. Not that it is more difficult it just has a bit more to it. For example, after your function name you have to add the curly braces, and write your logic in-between them. Then the closing curly brace becomes the ‘end’ to your function, and no longer have to write ‘end’, to let your function know where to stop. It is just the small little details that make a ruby method different from a JS function.

Another small detail but worth noting is declaring variables defers in both languages as well. In ruby you simply write your variable and set it to it value. In JS you declare a variable with “var, let, or const”, and then pass it its value. Again not a big deal here, it just takes some time to forget your old ruby muscle memory. To end this I would say just take a deep breathe, remember you are writing JS and it will soon become muscle memory like that language you once new ages ago ( a week ago!).

--

--