Update: Added info re uppercase and lowercase (#35094)

* Update: Added info re uppercase and lowercase

Included information to explain that lowercase and camelCase can be used for const identifiers.

* Fix: corrected mutable to immutable

I corrected the error that uppercase is used for mutable values.

* Fix: changed ** ** to <strong></strong>

I changed the markdown **  ** to <strong></strong>, as I was informed that ** didin't work.
pull/30123/head^2
Lee 2019-02-20 12:12:46 +08:00 committed by Manish Giri
parent 359a776425
commit 551c97feb1
1 changed files with 2 additions and 0 deletions

View File

@ -10,6 +10,8 @@ The keyword <code>let</code> is not the only new way to declare variables. In ES
<code>const</code> has all the awesome features that <code>let</code> has, with the added bonus that variables declared using <code>const</code> are read-only. They are a constant value, which means that once a variable is assigned with <code>const</code>, it cannot be reassigned.
<blockquote>"use strict"<br>const FAV_PET = "Cats";<br>FAV_PET = "Dogs"; // returns error</blockquote>
As you can see, trying to reassign a variable declared with <code>const</code> will throw an error. You should always name variables you don't want to reassign using the <code>const</code> keyword. This helps when you accidentally attempt to reassign a variable that is meant to stay constant. A common practice when naming constants is to use all uppercase letters, with words separated by an underscore.
<strong>Note:</strong> It is common for developers to use uppercase variable identifiers for immutable values and lowercase or camelCase for mutable values (objects and arrays). In a later challenge you will see an example of a lowercase variable identifier being used for an array.
</section>
## Instructions