JavaScript for Ruby Developers
Use Ruby experience to learn JavaScript: compare truthiness, Enumerable pipelines, Hash and Map, blocks and closures, method receivers, modules, and classes. Build a four-step order processor.
Ruby and JavaScript side by side
The same program in Ruby and in JavaScript, from the lessons of this course.
Interpolation and Templates
Ruby double-quoted strings interpolate with hash-braces; JavaScript interpolation uses backtick template literals and dollar-braces. JavaScript single and double quotes both create ordinary strings without interpolation. console.log prints a newline; Ruby…
Ruby1name = "Ada"2puts "Hello, #{name}!"JavaScript1const name = "Ada";2console.log(`Hello, ${name}!`);Equality Without Coercion
Ruby equality can be customized through ==, and arrays compare their contents. JavaScript strict equality avoids coercion but compares objects and arrays by identity. Use an explicit field or element comparison for value equality. JavaScript loose equality…
Ruby1puts(3 == "3")2puts([1] == [1])JavaScript1console.log(3 === "3");Array Mutation and Last Items
Ruby and JavaScript arrays are mutable and zero-indexed, but their APIs differ. Ruby push returns the array; JavaScript push returns its new length. Ruby negative indexing counts from the end, while JavaScript bracket lookup at negative one asks for a…
Ruby1items = [2]2result = items.push(3)3puts result.equal?(items)4puts items[-1]JavaScript1const items = [2];2items.push(3);3console.log(items.length);while, next, and continue
Ruby while and JavaScript while both repeat while their condition is true under each language's truth rules. Ruby next corresponds to JavaScript continue; break leaves the loop. JavaScript increments are available, but explicit updates often make a port…
Ruby1n = 32while n > 13 n -= 14end5puts nJavaScript1let n = 3;2while (n > 1) n -= 1;3console.log(n);Methods and Explicit Returns
Ruby methods normally return their final expression. JavaScript ordinary functions require return to provide a value; otherwise they produce undefined. Function declarations use parentheses and braces. JavaScript often tolerates extra arguments and gives…
Ruby1def twice(n)2 n * 23end4puts twice(4)JavaScript1function twice(n) { return n * 2; }2console.log(twice(4));JSON at the Boundary
Ruby JSON.parse requires its library and returns Ruby arrays, hashes, and primitives. JavaScript JSON.parse is built in and produces JavaScript values. JSON.stringify performs the inverse direction, but JSON cannot represent undefined, functions, or arbitrary…
Ruby1require "json"2puts JSON.parse("[2,3]")[1]JavaScript1console.log(JSON.parse("[2,3]")[1]);
Syllabus
10 chapters48 lessons1 project48 challenges99 quiz questionsFrom Ruby to JavaScript
6 lessonsDecisions and Flow
5 lessonsArrays, Hashes, and Maps
5 lessonsEnumerable to Array Pipelines
5 lessonsMethods, Blocks, and Functions
5 lessonsErrors and ES Modules
5 lessonsRuby Objects to JS Classes
6 lessonsComposition and Dispatch
5 lessonsProject: Order Processor
4 lessonsApply Your Ruby Experience
2 lessonsFrequently asked questions
Who is JavaScript for Ruby Developers for?
For people who already write Ruby and want to learn JavaScript. Each lesson starts from Ruby you know and shows how JavaScript does the same thing, so you skip the beginner basics.
Do I need to know JavaScript already?
No. The course starts with your first JavaScript program. You need Ruby basics: variables, conditions, loops, functions and collections.
How many lessons does JavaScript for Ruby Developers have?
JavaScript for Ruby Developers contains 48 interactive lessons you can complete at your own pace.
What does JavaScript for Ruby Developers cover?
The course is organized into chapters covering: From Ruby to JavaScript, Decisions and Flow, Arrays, Hashes, and Maps, Enumerable to Array Pipelines, and more.
Is JavaScript for Ruby Developers free?
Yes. Every course on Coddy is free to start. You can complete lessons in your browser without any downloads or signup.