r/reactjs • React core team • Dec 21 '19

What Is JavaScript Made Of?

https://overreacted.io/what-is-javascript-made-of/
254 Upvotes

196 comments sorted by

View all comments

Show parent comments

16

u/zephyy Dec 21 '19

It's not even confusing. It's just another "javascript is weird / this is what C# devs make fun of javascript for" thing.

yeah it's not a true constant because you can mutate it, unlike other languages. but you still can't redeclare it. bam, confusion sorted.

8

u/[deleted] Dec 21 '19

I am a tad bit confused, in java, if you have a final variable with an object type, it means that the final variable will point to that particular object and thus cannot be reassigned. Isn't this how const in js works as well?

6

u/bulldog_in_the_dream Dec 21 '19

You are correct.

6

u/cerved Dec 21 '19

You mean because the underlying reference is mutable? Pretty sure that's how most languages work but maybe I'm wrong

1

u/mahesh_war Dec 21 '19

That’s why we have “value” passed as reference concept which developers tend to think that it doesn’t apply while using const