discord greeting page for the Rust language Discord server

Rust's Discord page.

How to Learn Rust As a JavaScript Developer

Reasons to Learn Rust

Here's some advice if you're trying to learn the Rust language, especially if you're coming from a JavaScript background.

Learning Rust will make you a better programmer.

It will teach you about types and about memory management in ways that will help you with JavaScript too - especially if you encounter an obscure error.

It will also give you a new skill and a credential future employers may want you to have, judging by the spread of Rust in industry.

The main selling point for JS developers may be combining Rust with JavaScript through WASM, which can allow you to build blazing fast applications - especially for games and graphics.

Another great reason to learn Rust is as a systems language - a nice compliment to JavaScript, which is an application language.

Who cares about that? One example: Microsoft - they are officially adopting Rust for future projects.

By learning Rust now, you can have a leg up on a future where Rust will only get bigger in the future.

How JavaScript Is Different from Rust

Coding Rust feels very different from coding JavaScript.

Rust feels a little more similar to TypeScript, if you've tried that before, because it is strongly typed.

You have to get used to telling functions what type of value they should expect: string, float, integer.

In general you have to think about types in Rust a lot more than you have to in JavaScript. For example in JavaScript there's only string, but in Rust there's string and &str.

You also have to think about scope more - when a variable can no longer be used in a program, basically.

It can get complicated, but the Rust compiler will tell you when there's a mistake you need to fix.

How JavaScript Is Similar to Rust

There are some similarities between JavaScript and Rust, which will help you when learning it.

They're both computer languages, so some standard patterns in computer languages, like loops, are almost the same.

Some other control mechanisms, like case switches in JavaScript and matches in Rust, seem like they follow a similar logic too.

Finally, if you've tried to learn functional programming patterns in JavaScript, that's good training for Rust, which is very functional.

How to Get Started Learning Rust

Getting Set Up

The very first thing to do is to download Rust and get a "hello world" program working.


You should start there. You can't do anything more advanced than that until you do. (Also, a system problem can prevent you from getting even that far, as I found with Haskell and an earlier version of my OS).

Hello World

Here's 'hello world' in Rust - the minimum viable program, basically.

fn main() {

println!("Hello, world!");


Learning Cargo

Read up on Cargo, which is the package manager (and build system) for Rust, the equivalent of npn and yarn in JavaScript.

You'll be using Cargo to initialize your projects, install dependencies and build binaries.

You'll follow this pattern - start a project; install the dependencies; write a program; compile it; run the binary - over and over again in Rust, so you should get familiar with Cargo now.

The way you run programs is different in Rust than in interpreted languages like JavaScript.

Essentially, 'build' and 'run' are the same command in interpreted languages like JavaScript, and two different ones in compiled languages like Rust.

When you want to run a script in JavaScript, you execute it directly through node ("node script.js"). When you want to do the same in Rust, you'd tell crate to compile and then run it ("cargo run").

Further Education

YouTube Videos

For a gentle introduction to Rust concepts, see this YouTube series, which has about 40 bite-sized lessons in all, each approximately 5 minutes or less in length.

It also shows the elegance of the language, in my opinion.

Rust Programming Tutorial Short Video Series

There's also this video course by the teacher Chris Biscardi, showing how to do simple Rust exercises.

Rustlings by Chris Biscardi

Beyond that, for more structured content, there's also this Rust course on educative.io, available for free.



When you're ready for the next step, starting reading the Rust Programming Language book - a recommended resource for every Rust student.


I've also learned to ask questions, and get them answered, in the Rust subreddit.

There's also a good number of in depth tutorials you can find through Google.


Join the official Rust programming language Discord, which is active and has people answering all kinds of questions.


Incidentally, Discord itself is moving to Rust!


Rust is a language with a bright future - and by learning it, you can be a part of it.