Preparing to Learn JavaScript

Common JavaScript Methods

Luckily for us, JavaScript shares a lot of methods in common with Ruby. Some of those include .map(), .include? /.includes(), and .reduce(). However, JavaScript, or JS, has many methods that can do similar things but with different names. To name a very important one, the for…of iterator. It iterates through an array and lets you operate on each item. Think of this as a replacement for the for-loop. For example, if I had a list of colors in an array, and I wanted to change them all to lighter colors, I could use the for…of loop like such:

for … of loop used to iterate through the ‘colors’ array
logged in the console
This logs the same as the previous function: light red, light green, and light blue.

Mathematics in JavaScript

A few useful Math functions
Math function outputs


Although it is not the most fun subject, it is important to go into JavaScript knowing a few key pieces of syntax. Since we have been learning Ruby, a language that if rather flexible with its inputs, we need to be ready to be a little more implicit in JS. For starters, the use of curly braces {} is almost always necessary when defining a function body in JavaScript. For example, let’s look at the code below:

This function almost works
A big ugly error message
Yay! Working code!

Console Log

Enough console logs to start a console fire.
The printed results of our function!



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Aidan McBride

Aidan McBride

I ‘m a Web Developer and a Flatiron coding bootcamp alumni. I currently work in the financial tech industry as a Front End Engineer