text
stringlengths
1
81
start
float64
0
10.1k
duration
float64
0
24.9
occasionally want an alert but I don't
1,455.54
3.96
want an alert every single time I could
1,457.58
3.39
add a condition I could say something
1,459.5
2.94
like if I only want to display an alert
1,460.97
3.69
every time I count to a multiple of 10
1,462.44
4.29
like 10 and 20 and 30 and 40 and 50 and
1,464.66
4.14
so forth I could add a condition that
1,466.73
6.06
says that if counter mod 10 and mod just
1,468.8
6.09
gets me remainder when you divide by 10
1,472.79
3.6
so if you take the counter divide it by
1,474.89
4.44
10 if the remainder is 0 when I divide
1,476.39
4.919
by 10 well that means counter is a
1,479.33
4.2
multiple of 10 and so I can now display
1,481.309
4.681
an alert where I can display annele
1,483.53
4.529
that says like I want to say something
1,485.99
4.53
like the counter is now 10 or the
1,488.059
4.651
counter is now 20 and in order to do
1,490.52
3.87
that what I really want to do is have
1,492.71
5.31
some way of plugging in a variable into
1,494.39
6.57
a string inside of JavaScript and in
1,498.02
4.53
Python the way we would have done this
1,500.96
3.9
is by you appending f4 prepending F in
1,502.55
3.629
front of the string to create a
1,504.86
3.42
formatted string and then I would have
1,506.179
4.621
said something like the count is now and
1,508.28
5.22
then I'd use curly braces to say go
1,510.8
4.41
ahead and print out the value of counter
1,513.5
3.809
so this f4 formatted string followed by
1,515.21
3.66
this string would have been the way in
1,517.309
2.941
python that we would have done this
1,518.87
3.24
turns out javascript does the same thing
1,520.25
3.87
just with slightly different syntax it
1,522.11
4.98
doesn't use F instead instead of using
1,524.12
4.74
the regular quotation marks whether the
1,527.09
3.469
single or double quotation marks
1,528.86
4.47
JavaScript uses these backticks
1,530.559
4.841
which are usually located above the tab
1,533.33
5.37
key on a standard u.s. keyboard and this
1,535.4
5.01
is going to create what JavaScript calls
1,538.7
3.72
a template literal where I can then
1,540.41
3.39
substitute the value of a variable
1,542.42
3.96
somewhere inside of this template and
1,543.8
4.59
then in order to actually do the
1,546.38
4.29
substitution while Python uses double
1,548.39
4.26
curly braces to say plug in the value of
1,550.67
3.9
counter right here javascript does
1,552.65
3.54
something similar it also uses double
1,554.57
3.3
curly braces but there needs to be a
1,556.19
3.36
dollar sign in front of it the dollar
1,557.87
3.54
sign and then the dollar double curly
1,559.55
3.99
braces we can go ahead and plug in the
1,561.41
5.19
value of a variable there so this then
1,563.54
5.55
is a template literal where every time
1,566.6
4.44
we get to a multiple of ten we're going
1,569.09
3.51
to display an alert that says the count
1,571.04
4.38
is now and then this dollar sign curly
1,572.6
5.1
brace means actually plug in whatever
1,575.42
5.009
the value of counter happens to be right
1,577.7
5.609
there so now if I go ahead and refresh
1,580.429
5.671
counter it starts at zero I can count 3
1,583.309
5.671
4 5 6 7 8 9 but when I get to 10 then I
1,586.1
4.86
get an alert that says the count is now
1,588.98
4.65
10 and then I see the result update on
1,590.96
5.25
the page and so that template literal
1,593.63
5.07
can allow us to combine variables and
1,596.21
4.56
strings in order to generate new strings
1,598.7
4.74
that are able to represent data inside
1,600.77
6
of them as well so now what improvements
1,603.44
4.98
can we begin to make it what changes can
1,606.77
3
we make to this to improve upon the
1,608.42
3.3
design of it well one thing especially
1,609.77
3.78
as our programs get a little bit more
1,611.72
3.089
sophisticated a little bit more
1,613.55
3.509
complicated is that we often don't want
1,614.809
5.521
to be intermingling our JavaScript code
1,617.059
5.401
with the contents of our HTML the down
1,620.33
4.14
here we have button on click equals
1,622.46
3.87
count this name of this function and
1,624.47
3.9
especially as our page starts to get
1,626.33
3.93
more complicated it's going to start to
1,628.37
3.689
get a little bit annoying if we're
1,630.26
3.63
constantly having to maintain a little
1,632.059
3.301
bit of JavaScript code like making a
1,633.89
3.539
call to a function inside of our HTML
1,635.36
3.689
we'll see a little bit later there are
1,637.429
3.151
other paradigms that actually encourage
1,639.049
3.691
this type of thing but right now it can
1,640.58
4.05
start to get a little poorly designed if
1,642.74
3.84
we'd really like to separate all of our
1,644.63
4.139
JavaScript related code from all of the
1,646.58
4.55
HTML the general structure of our page
1,648.769
4.77
and so there are ways we can begin to do
1,651.13
4.98
that as well I can add an event listener
1,653.539
5.88
inside of JavaScript to that I can say
1,656.11
7.419
something like document dot query
1,659.419
8.911
selector button and then I can say dot
1,663.529
10.081
on click equals count so what's going on
1,668.33
7.26
here and I can do this instead of this
1,673.61
3.96
on click equals count what I'm now
1,675.59
4.829
saying is document query selector button
1,677.57
5.219