Comparison of Ruby and Javascript

Naming Convention
Ruby: snake_case
JavaScript: camelCase
Falsy Values

Classes
initialize vs constructor
Ruby:

JavaScript:

Determine Data Type
.class and .constructor
Append .constructor to objects in JavaScript and.classin Ruby to determine what type of data something is (i.e. Number, Fixnum, String, Object, Hash, Array, etc.).
Ruby: See other possible class types.

JavaScript: See other possible constructor types.

Methods
.method_name vs .methodName()
Ruby: Methods that do not take an argument don’t require parenthesis (i.e. .upcase)
"example".upcase => "EXAMPLE"JavaScript: Almost all methods require parenthesis at the end to execute.
"example".toUpperCase() // "EXAMPLE"Debugging
Ruby: binding.pry
JavaScript: debugger
Strict Equality Operator
Ruby: == checks not only the equality of the two values but it also compares the types of the two values too (i.e. 5 === “5” returns false, 5 === 5 returns true).
JavaScript: === works just like Ruby’s == operator would. JavaScript also has its own == operator and should not be confused with Ruby’s.
Arrays
.each vs .forEach
Ruby:

JavaScript:

Variables
Ruby: You can simply set any non-reserve word equal to any value, including null. A variable that begins with an uppercase letter is known as a constant and has different characteristics.
var_name = "hello"
DOGS = ["fido", "snoopy", "nala"]
JavaScript: The process of declaring a variable is and actually setting the value of that variable are two separate processes which are generally grouped into one line.
const blah = "hello"
let hey = "yo"
hey = "no" //reassigning value

Parsing
to_i vs parseInt()
Ruby: Converting a string to a number is quite simple in Ruby as you would just append .to_i to the string.

JavaScript: The parseInt() function also parses a string and returns an integer.

String Interpolation
#{} vs ${}
Ruby:

JavaScript:

Looping
The looping syntax is different for the two languages and it’s obvious which one is more simple.
Ruby:

JavaScript:

Conclusion
Ruby and Javascript both have their advantages and disadvantages. I learned Ruby first and thought it was much less of a rollercoaster than learning JavaScript. Either way, there’s only one way to get better at programming and that’s by practicing AKA coding, coding, coding, and some more coding.
Enjoy the ride (or try to)!
