Calculator Project: JavaScript

Examining Events in the Browser

Calculator Project: JavaScript

Check out a free preview of the full Calculator Project: JavaScript course

The "Examining Events in the Browser" Lesson is part of the full, Calculator Project: JavaScript course featured in this preview video. Here's what you'd learn in this lesson:

Brian demonstrates what an event looks like in the browser, and also how to test the calculator by logging to the console.

Preview
Close

Transcript from the "Examining Events in the Browser" Lesson

[00:00:00]
>> Brian Holt: So let's actually just say console.log(event) just to take a look at that. Where is? So here, I'm just gonna open my desktop, calc, index.html. I open my console here. They put five so you can see here it's a click event, and it has just a bunch of stuff on it.

[00:00:29]
Hold keys, cancel bolt, like you can, where the mouse is at, do they hold the control key when they clicked it? Other stuff that I just never cared about. Timestamp, when it actually happened. All sorts of stuff.
>> Speaker 2: So you have to tell it when I click call this function, that'll take in something that I called event but that event will automatically be that stuff.

[00:00:58]
>> Brian Holt: Yep, the browser will always give you that. You can depend on the browser, it'll always give you that. So to even drive that for further, let's take this one out of here and go back up to button click, I'm gonna put console.logvalue
>> Brian Holt: And refresh, so notice that now it's actually giving me the correct number that I clicked.

[00:01:23]
including this crazy intercode things.

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now