News for hackers. Stuff that matters.
Re:JavaScript variables: var and let and const by Octoth0rpe on Friday March 06, 2020 @04:45PM (#22507625)
My inner pedant really hates this first sentence:

> There are three ways to create variables in a JavaScript application: using var, using let, or using const.

No. There are two ways to create variables (let, var), and _one_ way to create a constant (const).

Re:JavaScript variables: var and let and const by anamexis on Friday March 06, 2020 @05:06PM (#22507780)
Your inner pedant isn't being pedantic enough, then, because the ES spec defines them all as variables.

> 13.3.1 Let and Const Declarations

>

> NOTE let and const declarations define variables that are scoped to the running execution context’s LexicalEnvironment.

http://www.ecma-international.org/ecma-262/6.0/#sec-declarat...

Re:JavaScript variables: var and let and const by winrid on Saturday March 07, 2020 @03:24AM (#22510542)
They're not really constant though, if you wanna be really pedantic. You can modify a const object for example.
Re:JavaScript variables: var and let and const by pfdzm on Saturday March 07, 2020 @03:51AM (#22510665)
It’s constant because it cannot be reassigned - but it is not immutable.
Re:JavaScript variables: var and let and const by winrid on Saturday March 07, 2020 @03:59AM (#22510691)
Right.