Vissza a blograBack to blog
Rust TypeScript

Ownership: the concept JS never forced me to understand Ownership: the concept JS never forced me to understand

Krisztián

Krisztián

2026. márc. 14.March 14, 2026

2 perc olvasásmin read

I’ve been a JavaScript/TypeScript developer for 6+ years. Here’s what surprised me when I started learning Rust.

Coming from the JS ecosystem, I expected a steep learning curve, but I didn’t expect it to change how I think about code.

The biggest mindset shift? Ownership.

In JavaScript, you don’t think about who “owns” a value:

const a = { name: "Krisztián" };
const b = a; // both point to the same object, no problem
console.log(a.name); // works fine

In Rust, this breaks:

let a = String::from("Krisztián");
let b = a; // ownership moved to b
println!("{}", a); // ❌ compile error: value borrowed after move

At first this feels like the compiler is fighting you. Then it clicks: the compiler isn’t your enemy, it’s that one brutally honest teammate who won’t let you ship broken code at 2am.

And that’s exactly what those two examples show in practice. In JavaScript, you’re basically trusting yourself not to shoot yourself in the foot: mutating something you shouldn’t, accessing data that’s already gone, shared state going sideways in an async call. These are all on you. Rust just takes that responsibility away. If it compiles, those bugs can’t exist. Not “probably won’t”, literally can’t.

JS gives you freedom. Rust gives you guarantees. Both have their place, but learning Rust is making me a more intentional TypeScript developer too. I think twice before mutating shared state now.

Still early days for me with Rust, but already worth it!

I’ve been a JavaScript/TypeScript developer for 6+ years. Here’s what surprised me when I started learning Rust.

Coming from the JS ecosystem, I expected a steep learning curve, but I didn’t expect it to change how I think about code.

The biggest mindset shift? Ownership.

In JavaScript, you don’t think about who “owns” a value:

const a = { name: "Krisztián" };
const b = a; // both point to the same object, no problem
console.log(a.name); // works fine

In Rust, this breaks:

let a = String::from("Krisztián");
let b = a; // ownership moved to b
println!("{}", a); // ❌ compile error: value borrowed after move

At first this feels like the compiler is fighting you. Then it clicks: the compiler isn’t your enemy, it’s that one brutally honest teammate who won’t let you ship broken code at 2am.

And that’s exactly what those two examples show in practice. In JavaScript, you’re basically trusting yourself not to shoot yourself in the foot: mutating something you shouldn’t, accessing data that’s already gone, shared state going sideways in an async call. These are all on you. Rust just takes that responsibility away. If it compiles, those bugs can’t exist. Not “probably won’t”, literally can’t.

JS gives you freedom. Rust gives you guarantees. Both have their place, but learning Rust is making me a more intentional TypeScript developer too. I think twice before mutating shared state now.

Still early days for me with Rust, but already worth it!