Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial

Samuel Yanez
27,790 PointsWhat's the difference between Javascript and Ruby?
Guys, what is the difference between Javascript and Ruby? I know both are programming languages and often used in web development. So far, I have used Javascript to built interactive website and create small web apps. But, I was wondering if I could have done these projects in Ruby as well. When do you use Ruby over Javascript, or when do you use Javascript over Ruby?
2 Answers

Greg Kaleka
39,021 PointsHi Samuel,
Javascript is a "front-end" programming language, meaning it is used to govern interaction on the client side, or at the browser level (this is why you can open up the Chrome console, and start typing in JS to interact with the web page you're on).
Ruby is a "back-end" language. It can be used to generate HTML and Javascript, but it is compiled on the server side. The other thing that back-end languages do is interact directly with databases. A back-end language is necessary if you want to have user accounts, for example.
An aside - there are javascript-based frameworks like Node.js that provide back-end infrastructure you can write using Javascript, so the distinction is not 100% clean.
Hope this helps clear things up!
-Greg

Art Hayes
7,251 PointsYou can't really compare them as they are two different things. Ruby on Rails is a framework. If you're referring to Node.js vs Ruby -- Ruby is 'opinionated', meaning you have to build your apps using their methods / structures. In other words, it's expecting you to follow their language to a 't'. Node.js is not a framework (and is unopinionated) - and it can do simple stuff when you first set it up, but you have to write or install modules and chunks of code to get it to work like Ruby does out of the box.
I'm learning Ruby right now because you basically get API endpoint support 'for free'. It's so easy to set one up it's ridiculous... with Node.js, there appears to be a lot more work involved in order to support the same functionality.
That's not to say Node.js isn't valuable, because I believe it is - but you can't really compare the two.
I suggest trying Rails for Zombies as an introduction - then try some of the Ruby courses here at Treehouse... it's a very interesting language.
Edit: One more thing... I highly recommend getting a heroku.com account. You can build a Node.js or Ruby test server right through their console, and mess around with the code and publish from your desktop using their CLI. It's super cool - and free.

Greg Kaleka
39,021 PointsHey Art,
Just to clarify, Rails is a back-end framework that uses the Ruby language. Node.js is a back-end framework that uses the Javascript language.
From the Node.js about page:
| As an asynchronous event driven framework, Node.js is designed to build scalable network applications.
Samuel Yanez
27,790 PointsSamuel Yanez
27,790 PointsThanks Greg! This really helped. So, Ruby is a back-end language as PHP. I was thinking on starting some back-end track once I finish with my current front end development track on Treehouse. Do you have any preference between Ruby or PHP?
Greg Kaleka
39,021 PointsGreg Kaleka
39,021 PointsYep. Ruby, PHP, Python, Go... all languages that are used as web back-ends (among other things).
I would probably suggest going with Ruby - it's a bit more modern than PHP, and there are lots of resources out there for learning. The one real advantage for PHP, though, is Wordpress. Wordpress is pretty ubiquitous, and you could get your coding career started doing something like developing a WP plugin, for example. That said, I still think I'd recommend Ruby.
Happy coding :)
Tyler Taylor
17,939 PointsTyler Taylor
17,939 PointsI think ruby is easier and far more beautiful than PHP. That said, I see a lot more job ads for PHP/wordpress developers. So I'm trying to divide my learning evenly :)