Javascript and Ruby Comparison
In this blog post, I will contrast the two languages I already know, Ruby and Javascript, as a recap and review.
Ruby
- Object-oriented language
- Backend language used for server side applications
- Rails & Sinatra are example frameworks
- false and nil are “falsy” values
- Functions are not first class objects
- String interpolation is done via “ “ tags, with #{ } wrapped around variables.
- Hashes are sets of key value pairs.
Javascript
- Primarily object-oriented language, but has functional programming language qualities
- Frontend or backend language
- Many example frameworks and libraries, including AngularJS, React, Node.js, Express.js, and so forth.
- Many more falsy values including false and nil, such as undefined, 0, and NaN
- Functions are first class objects and can be used as objects, passed around, and used as arguments for other functions.
- String interpolation is done via ` ` tags, with ${} wrapped around variables
- Objects are sets of key value pairs.
Conclusions
Ruby and Javascript have some similarities, but are pretty different languages that are used in different situations. Generally, Javascript is more popular and has more uses, such as being in the MEAN/MERN stacks, which allow programmers to use one language (Javascript!) for their entire stack. However, Ruby definitely has its uses, as the beginner friendly language with the powerful Rails framework, which allows you to spin up sites and MVPs extremely quickly.