text
stringlengths
1
81
start
float64
0
10.1k
duration
float64
0
24.9
that element that we have found and to
1,231.46
4.38
do that we can store an element inside
1,233.77
3.72
of a variable in the same way that a
1,235.84
3.72
variable can store a number like a
1,237.49
4.35
counter or a string like hello world it
1,239.56
4.68
can also store other values like an HTML
1,241.84
5.04
element that we get back from document
1,244.24
4.77
dog query selector so I could say
1,246.88
6.54
something like let heading we're heading
1,249.01
6.63
is just the name of a variable the equal
1,253.42
5.85
to document query selector h1 for
1,255.64
5.94
instance find the h1 element save it
1,259.27
3.84
inside of a variable called heading and
1,261.58
4.32
now rather than document query selector
1,263.11
4.83
each one all the time I can just say if
1,265.9
4.23
the headings inner HTML is hello
1,267.94
4.98
then set the headings inner HTML to good
1,270.13
3.21
bye
1,272.92
2.91
otherwise I set the headings inner HTML
1,273.34
3.51
to hello
1,275.83
2.46
so I've improved the efficiency of the
1,276.85
3.36
program but also reduce the number of
1,278.29
3.36
characters of code that I've had to
1,280.21
3
write my lines are now much shorter a
1,281.65
3.39
little bit easier to read this we would
1,283.21
4.11
consider to be an improvement in design
1,285.04
4.17
and it turns out there's one other
1,287.32
4.47
improvement we can make here too that we
1,289.21
4.74
can define a variable like let something
1,291.79
4.11
equal something else but it turns out
1,293.95
3.48
that JavaScript gives us a couple of
1,295.9
4.14
ways to define a variable and if we're
1,297.43
4.56
going to be creating a variable whose
1,300.04
4.38
value is never going to change we're
1,301.99
4.26
never going to reassign the variable
1,304.42
4.17
name to something else then instead of
1,306.25
4.62
let we can enforce that it's never going
1,308.59
5.31
to change by calling it a Const variable
1,310.87
5.91
so Const heading equals document query
1,313.9
5.31
selector h1 means I am going to create a
1,316.78
4.44
variable called heading setting it equal
1,319.21
4.35
to the result of document query selector
1,321.22
5.82
h1 and never again will I change what
1,323.56
5.1
heading is equal to I will never have
1,327.04
3
another line of code that says heading
1,328.66
3.63
equals something else because it is
1,330.04
3.87
constant and JavaScript will then
1,332.29
3.27
enforce that this variable should not
1,333.91
3.72
change and if ever I do try to change it
1,335.56
3.66
javascript will give me an error and
1,337.63
3.84
this can just be helpful to prevent
1,339.22
4.14
against possible unintended behavior
1,341.47
3.81
that if you know you have a variable it
1,343.36
3.69
is never going to change it's often good
1,345.28
4.71
designed to label it as a constable so
1,347.05
4.29
that you and other people looking at
1,349.99
1.75
your code
1,351.34
2.41
know that that is never going to have a
1,351.74
5.25
value that gets changed later on so this
1,353.75
5.7
then will behave the same way where it
1,356.99
4.38
says hello but I can toggle it back and
1,359.45
4.74
forth changing it to goodbye and then
1,361.37
5.67
changing it back to hello again and so
1,364.19
4.83
now using this ability this ability to
1,367.04
4.019
manipulate the dawn we can go back to
1,369.02
4.02
our counter program and actually improve
1,371.059
4.471
upon it that right now the counter
1,373.04
5.28
program I count and it displays an alert
1,375.53
4.59
that says 1 I count and it displays an
1,378.32
3.9
alert that says 2 I can probably do a
1,380.12
4.23
little bit better than that by instead
1,382.22
4.11
of displaying an alert actually
1,384.35
4.86
manipulating the Dom in some way that I
1,386.33
4.86
would like to have this h1 this big
1,389.21
3.81
heading at the top instead of starting
1,391.19
3.989
up by saying hello let's have it start
1,393.02
5.25
out by saying 0 for example just some
1,395.179
5.821
initial value for the counter and now
1,398.27
4.26
when I increment the value of counter
1,401
3.63
rather than display an alert that just
1,402.53
3.779
tells me the value of the counter in an
1,404.63
4.26
alert I'm going to instead say document
1,406.309
7.671
query selector h1 . innerhtml
1,408.89
10.05
equals counter where i'm saying find the
1,413.98
7.42
h1 element updated innerhtml
1,418.94
4.8
set it equal to whatever the value of
1,421.4
5.1
the variable counter happens to be such
1,423.74
4.86
that now if i refresh this page the
1,426.5
3.96
value of this h1 initially is 0 that's
1,428.6
3.66
the initial value but every time I click
1,430.46
4.05
count we're going to update the contents
1,432.26
4.26
of that h1 element and this time setting
1,434.51
5.22
it to 1 2 3 4 and so forth every time I
1,436.52
4.74
click the count button it's going to
1,439.73
3.18
increment the value of the variable as
1,441.26
3.93
well as manipulate the Dom actually
1,442.91
5.82
making changes in order to produce the
1,445.19
5.489
effect that I want to see on this actual
1,448.73
5.07
page and we can begin to add additional
1,450.679
4.861
logic to this as well maybe I do
1,453.8
3.78