text stringlengths 1 81 | start float64 0 10.1k | duration float64 0 24.9 |
|---|---|---|
and | 4,820.01 | 1.91 |
go ahead and run that count function | 4,820.78 | 3.66 |
every 1000 milliseconds otherwise known | 4,821.92 | 5.25 |
as every one second go ahead and run the | 4,824.44 | 5.179 |
count function so now when I open | 4,827.17 | 6.659 |
counter dot HTML it's zero but every | 4,829.619 | 5.741 |
second now it's going to change every | 4,833.829 | 3.511 |
second updating one by one by one I | 4,835.36 | 3.509 |
don't have to click the button of course | 4,837.34 | 2.91 |
I could and the event handler would | 4,838.869 | 3.181 |
still work but the interval is saying | 4,840.25 | 4.829 |
now every one second go ahead and run | 4,842.05 | 4.68 |
the count function and that has this | 4,845.079 | 3.241 |
particular result so if you've ever seen | 4,846.73 | 3.449 |
a webpage that like displays the current | 4,848.32 | 3.48 |
time in seconds and like a countdown | 4,850.179 | 3.571 |
timer or is displaying the current time | 4,851.8 | 3.75 |
with seconds it might be doing something | 4,853.75 | 3.15 |
like this just having some sort of | 4,855.55 | 3.54 |
interval that every second is going to | 4,856.9 | 4.02 |
count and increment in order to say | 4,859.09 | 3.75 |
update the number to the one greater one | 4,860.92 | 3.92 |
greater and one greater than that of | 4,862.84 | 5.19 |
course if I close the page and go back | 4,864.84 | 5.379 |
to it if I close these pages and then | 4,868.03 | 5.279 |
open counter dot HTML again I've gone | 4,870.219 | 5.161 |
back to zero like JavaScript is not | 4,873.309 | 4.83 |
saving any state about my page it's just | 4,875.38 | 5.1 |
every time we're running the page it's | 4,878.139 | 5.131 |
going to go back to counter j/s it's | 4,880.48 | 4.02 |
going to say all right we're defining a | 4,883.27 | 2.82 |
variable called counter we're setting | 4,884.5 | 3.719 |
that variable equal to zero so every | 4,886.09 | 3.299 |
time I load the page it's going to be | 4,888.219 | 3.57 |
set back to zero and that might not be | 4,889.389 | 4.23 |
great depending on the type of page | 4,891.789 | 3.301 |
you're trying to create that maybe you | 4,893.619 | 3.571 |
want to page that is somehow able to | 4,895.09 | 4.17 |
store information such that on | 4,897.19 | 3.779 |
subsequent visits were able to utilize | 4,899.26 | 3.779 |
the information that was already stored | 4,900.969 | 4.351 |
some way of remembering information for | 4,903.039 | 4.651 |
later use in later versions of | 4,905.32 | 4.23 |
JavaScript and more modern browsers now | 4,907.69 | 3.69 |
allow us to do something just like that | 4,909.55 | 4.109 |
called local storage and what local | 4,911.38 | 4.469 |
storage is is it's a way for us to be | 4,913.659 | 4.471 |
able to store information inside of the | 4,915.849 | 4.35 |
user's web browser that a page can ask | 4,918.13 | 4.259 |
to store particular values inside the | 4,920.199 | 4.44 |
web browser and later on on subsequent | 4,922.389 | 4.321 |
visits to that page we can go back and | 4,924.639 | 4.111 |
say let's extract those values that were | 4,926.71 | 4.679 |
previously stored inside of local | 4,928.75 | 4.98 |
storage local storage it's going to give | 4,931.389 | 4.201 |
us access to two key functions that | 4,933.73 | 3.3 |
we're going to use to manipulate this | 4,935.59 | 2.129 |
local storage | 4,937.03 | 3.72 |
the first is local storage getitem where | 4,937.719 | 4.44 |
we would like to get something out of | 4,940.75 | 3.869 |
local storage based on its key some name | 4,942.159 | 4.471 |
that we have given to that value and we | 4,944.619 | 3.96 |
also have access to local storage dot | 4,946.63 | 4.409 |
set item which goes ahead and adds a new | 4,948.579 | 4.261 |
value to local storage or replaces an | 4,951.039 | 3.301 |
existing value in local storage | 4,952.84 | 4.65 |
setting this key equal to a particular | 4,954.34 | 5.73 |
value so we can use local storage then | 4,957.49 | 4.83 |
to allow our webpages using javascript | 4,960.07 | 4.2 |
to be able to store information and | 4,962.32 | 4.02 |
retrieve information from the browser | 4,964.27 | 4.38 |
and let's now try to use that in order | 4,966.34 | 6.09 |
to solve this problem of the counter | 4,968.65 | 6.05 |
that seems to always reset back to zero | 4,972.43 | 5.01 |
so now in counter jeaious instead of | 4,974.7 | 4.72 |
sending counter equal to zero the first | 4,977.44 | 4.41 |
thing I want to know is is there already | 4,979.42 | 5.22 |
a value for the counter in local storage | 4,981.85 | 6.75 |
so I can ask a question like if local | 4,984.64 | 8.28 |
storage dot get item counter meaning go | 4,988.6 | 7.05 |
to local storage try and get the counter | 4,992.92 | 5.67 |
and anything in this if expression will | 4,995.65 | 5.34 |
happen if there is something inside of | 4,998.59 | 4.41 |
local storage for counter but it turns | 5,000.99 | 3.36 |
out that if I want to do the inverse of | 5,003 | 3.15 |
that say not I can just use the | 5,004.35 | 3.72 |
exclamation point much like in C in | 5,006.15 | 3.69 |
JavaScript the exclamation point just | 5,008.07 | 4.23 |
means not so meaning if there is not | 5,009.84 | 4.35 |
something in local storage called | 5,012.3 | 4.2 |
counter well then let's go ahead and | 5,014.19 | 4.17 |
just set the value in local storage | 5,016.5 | 5.64 |
local storage dot set item counter and | 5,018.36 | 6.48 |
we'll set it equal to zero so what this | 5,022.14 | 4.65 |
is doing here is before anything else | 5,024.84 | 4.32 |
happens we are checking local storage to | 5,026.79 | 5.09 |
say is there already a value for counter | 5,029.16 | 5.34 |
and if there is not already a value for | 5,031.88 | 4.21 |
counter we need to make sure there is | 5,034.5 | 3.03 |
something there inside of local storage | 5,036.09 | 3.09 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.