This lesson, we're going to set up a timer, we need to add in a few variables that can hold a start
time and an end time so we can call it start time and end time.
So that's setting up those two global variables that we can add in start and end times into.
So now when we hit Play the game, we want to grab the current time.
And with JavaScript Dete, we are getting the system time.
So this is whatever your browser, whatever your computer system time is, this is the date that it's
going to get.
So let's get our late date and we're going to equal that to new date using the same date object that
we used in the earlier lessons, our start time taking our date object and getting time.
So this returns back that Unix time stamp, which is a universal time stamp and we can console log out
that start time so that we can see it within the console.
And I'm also going to update the button text.
So it's no longer going to be start.
It's going to be done.
So we're going to update that in our text to done.
So let's try that out.
So make this a little bit smaller.
Refresh the page and we should see that this button should change to be done as well as we should see
the random value there as well as the random time value.
So let's try that.
So this is the random start time.
And as we can see, that this button is no longer functioning because we are listening for a start.
So once the entire tax changes, even though we still have the same a button present, we didn't have
to hide the button.
So a different button.
All we did is update that inner text, and that gives us the ability to run different functionality
on that same event listener with the same button element.
So when we refresh it, you're going to see that this time has actually advanced.
So this is a value that we can get and we can check to see the difference between milliseconds.
So we're recording the start time and next we need to record the end time.
So this is what the user is going to press when they're done typing and this is where we're going to
do all of our calculations.
So try that one more time.
When the player pluses start, then it enables the ability to type in the text area.
And the idea is that they type exactly what they see.
And then we're going to calculate out how accurate they were, as well as how quickly they were able
to type that string.
So that's all still to come in the next lesson, go ahead and add in the start time and start time functionality.
And coming up next, we're going to add in the gameplay.
So that's still to come.