JavaScript for Rust Developers
Transfer Rust experience to JavaScript through values, collections, functions, modules and object behavior. Compare ownership, traits and errors, build an order processor, and port a ledger.
Rust and JavaScript side by side
The same program in Rust and in JavaScript, from the lessons of this course.
Formatting and Templates
Rust formatting macros check their placeholders, while JavaScript interpolates expressions in backtick template literals. Ordinary quoted JavaScript strings do not interpolate. Rust String contains UTF-8 bytes, while JavaScript length counts UTF-16 code…
Rust1 2fn main() {3let name="Ada";println!("Hello, {}!",name);4}JavaScript1const name = "Ada";2console.log(`Hello, ${name}!`);Value and Identity Equality
Rust PartialEq compares supported values, and vectors or arrays can compare their elements. JavaScript === compares primitives without coercion but objects and arrays by identity. Matching contents do not make two arrays equal. A custom equals method is an…
Rust1 2fn main() {3let a=vec![1,2];let b=vec![1,2];println!("{}",a==b);4}JavaScript1console.log(3 === "3");Vec and Array Objects
Rust Vec owns growable storage of one element type, while arrays encode a fixed length in their type. JavaScript Array is a growable reference object and can hold mixed value types. push returns the new length, and assignment shares the array rather than…
Rust1 2fn main() {3let mut items=vec![2];items.push(3);println!("{}",items.len());4}JavaScript1const items = [2];2items.push(3);3console.log(items.length);While and Early Exit
Rust and JavaScript both provide while, break and continue. Rust loop can yield a break value, while ordinary JavaScript loop statements do not return such a value. JavaScript conditions use truthiness instead of requiring bool. Advance manual indexes along…
Rust1 2fn main() {3let mut n=3;while n>1 {n-=1;}println!("{}",n);4}JavaScript1let n = 3;2while (n > 1) n -= 1;3console.log(n);Signatures and Runtime Calls
Rust function signatures check parameter and return types, and a tail expression returns its value without a semicolon. JavaScript ordinary function bodies need return; falling through yields undefined. JavaScript does not enforce Rust-style argument types or…
Rust1fn twice(n:i32)->i32 {n*2}2fn main() {3println!("{}",twice(4));4}JavaScript1function twice(n) { return n * 2; }2console.log(twice(4));JSON and Dynamic Data
Rust commonly uses an external crate for JSON decoding and can deserialize into a typed model. JavaScript JSON.parse checks JSON syntax but does not validate the application’s expected fields or ranges. The Rust fixture example is deliberately narrow, not a…
Rust1 2fn main() {3let fixture="[2,3]";let values:Vec<i32>=fixture[1..fixture.len()-1].split(',').map(|s|s.parse().unwrap()).collect();println!("{}",values[1]);4}JavaScript1console.log(JSON.parse("[2,3]")[1]);
Syllabus
10 chapters48 lessons1 project48 challenges99 quiz questionsFirst JavaScript
6 lessonsDecisions and Flow
5 lessonsCollections
5 lessonsIteration Pipelines
5 lessonsFunctions
5 lessonsErrors and Modules
5 lessonsObjects and Classes
6 lessonsComposition and Dispatch
5 lessonsProject: Order Processor
4 lessonsApply Your Rust Experience
2 lessonsFrequently asked questions
Who is JavaScript for Rust Developers for?
For people who already write Rust and want to learn JavaScript. Each lesson starts from Rust 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 Rust basics: variables, conditions, loops, functions and collections.
How many lessons does JavaScript for Rust Developers have?
JavaScript for Rust Developers contains 48 interactive lessons you can complete at your own pace.
What does JavaScript for Rust Developers cover?
The course is organized into chapters covering: First JavaScript, Decisions and Flow, Collections, Iteration Pipelines, and more.
Is JavaScript for Rust Developers free?
Yes. Every course on Coddy is free to start. You can complete lessons in your browser without any downloads or signup.