All language subtitles for 002 Understanding _let_ and _const__en

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranî)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian Download
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu

Original subtitles

Let's dive right into it with let and const. These are two keywords you're going to see a lot in this

course, especially const. Let and const are different ways of creating variables.

You know var, var creates a variable in javascript.

Now the thing is some variables never really change,

They are so-called constants.

Technically though, they are.

They are all just variables because javascript only knows var. With ES6, a version of javascript, two different

keywords were introduced, let and const. Var still works but you're highly encouraged to use let and const

Let is

so to say the new var, you use it for variable values. Let and const are all to changing something behind the

scenes about the scope of variables.

But the most important takeaway here is use let if you want to create a variable that really is variable.

Use const if you plan on creating a constant value, so something which you only assign once and never

change.

And that is the case more often than you might think.

In this course you will never see var, you will only see let and const and mostly it's const. So it

shouldn't confuse you,

It's simply the same as var, just in a more modern way, and in the case of const, although clearly

showing, this is never going to receive a new value.

Now since this is always a bit clearer in practice let's have a look at it. For this,

It's best if you use jsbin

.com,

That's another web editor which makes it easy for us to enter some javascript and see some console output

for that, disable HTML and output up there and instead to enable Javascript and console.

Now on the left side you can right next generation javascript, on the right side you'll see the output.

So there we can create a variable.

My name, set an equal to Max, console log my name, now hit control enter you'll see Max on

the right,

Not that new to you probably.

Obviously we can then set my name to Manu and if we then console log my name again.

It might also not totally surprise you that if you clear and run this again you'll see Max

From the first statement and Manu from the second one.

Now if you change var to let,

Nothing's going to change.

Hitting run still works the exact same way. If you use const though like this.

Then clearing and running this will output Max,

But then throw an error, since we try to reassign a constant variable which is kind of a strange name.

This is const and this is the idea behind const.

You can say this should never get a new value and if you then accidentally write some code where you

reassign it you get the error and hence a chance to improve your code.

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.