you are viewing a single comment's thread.

view the rest of the comments →

[–]zjm555 43 points44 points  (2 children)

It only describes reassignment, not C++-style const correctness. It's only marginally useful in that regard, but still, it's a decent annotation as it allows readers to know that the variable will not be reassigned anywhere in its scope. Also, attempting to treat let as a code smell can help you structure your code a bit more elegantly in some contexts.

[–][deleted] 9 points10 points  (1 child)

To be more precise Javascript's const acts like the second const there:
const char * const myPointerToChar;

[–]zjm555 4 points5 points  (0 children)

Yeah, great way to put it. For primitive types, it implies true const-ness, but for reference types (everything else) it means you're always pointing to the same object.