Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
WEBVTT
1
00:00:00.000 --> 00:00:04.000
Alright now let's
2
00:00:04.000 --> 00:00:08.000
declare a variable called interest rate. So let
3
00:00:08.000 --> 00:00:12.000
interestRate and we set this to .
4
00:00:12.000 --> 00:00:16.000
3. Now this is the initial value, we can always change that
5
00:00:16.000 --> 00:00:20.000
later, so, we can set interest rate to let's say 1,
6
00:00:20.000 --> 00:00:24.000
now if you log this on the console, of course
7
00:00:24.000 --> 00:00:28.000
we're going to see the new value, right? So save the changes, and here's
8
00:00:28.000 --> 00:00:32.000
one on the console. However, on a real world application,
9
00:00:32.000 --> 00:00:36.000
there are situations that we don't want the value of a variable to change.
10
00:00:36.000 --> 00:00:40.000
Because otherwise it's going to create all kinds of bugs in our
11
00:00:40.000 --> 00:00:44.000
application. In those situations, instead of a variable, we
12
00:00:44.000 --> 00:00:48.000
use a constant. So the value of a variable as
13
00:00:48.000 --> 00:00:52.000
the name implies, can change, but the value of a constant cannot change.
14
00:00:52.000 --> 00:00:56.000
So here, if we change let
15
00:00:56.000 --> 00:01:00.000
to const. Now interestRate will be constant.
16
00:01:00.000 --> 00:01:04.000
So, when I save the changes, we're going to see an error
17
00:01:04.000 --> 00:01:08.000
in the console on line 3, where we reassign
18
00:01:08.000 --> 00:01:12.000
interestRate. So let's have a look. Save the changes. And here's the error.
19
00:01:12.000 --> 00:01:16.000
Uncaught typeError assignment to constant
20
00:01:16.000 --> 00:01:20.000
variable. You can see this error happened in index.js
21
00:01:20.000 --> 00:01:24.000
line 3, now if you click here, you can
22
00:01:24.000 --> 00:01:28.000
see the line in code where this error occurred. So we cannot
23
00:01:28.000 --> 00:01:32.000
reassign a constant. Alright now, back to the constant.
24
00:01:32.000 --> 00:01:36.000
So, here is the best practice, if you don't need to reassign
25
00:01:36.000 --> 00:01:40.000
constant should be your default choice. Otherwise
26
00:01:40.000 --> 00:01:44.000
if you need to reassign a variable, use let.
2245
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.