logoalt Hacker News

Waterluvianyesterday at 5:21 PM1 replyview on HN

Yeah exactly. That's what I've loved about Rust and hated about real-world JS. I end up having to reason about an entire case that might not be real at all: does this function mutate what I'm passing it? Should I eagerly deep copy my object? UGH.


Replies

stephbookyesterday at 5:44 PM

Just call "Object.freeze()" before "return" in your function.

show 1 reply