Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Different forms of using 'let'

Tags:

javascript

I saw a tutorial for JavaScript ES6 in which the guy used this syntax to assign a value with let:

let = name = ['Jhon','Paul','Ean']

What is the difference between the first and this:

let name = ['Jhon','Paul','Ean']
like image 842
Steven Daniel Anderson Avatar asked Aug 05 '17 10:08

Steven Daniel Anderson


People also ask

What form of verb is used with LET?

Usage Let is followed by a verb that has the form of the infinitive without to. Let is never used as be let; use be allowed or be permitted instead. Let me do that for you.

What is correct lets Or let's?

The difference between let's and letsLet's is a contraction of “let us.” You use it to make suggestions about what you and someone else should do. Let's go to the movies. Let's invite Mom. Lets is the third-person singular present tense form of verb let, which means to allow or give permission.


1 Answers

  • The first one is creating two global variables: let and name, and assigning the array first to name and then to let. It is not what you want for sure.

  • The second one creates a block scope local variable called name. This is the one you want!

like image 174
Alberto Trindade Tavares Avatar answered Sep 30 '22 02:09

Alberto Trindade Tavares