Third time is a charm

Summary:

  • Stand up Tables
  • Handling events
  • Using Pause on exeptions (Chrome dev tool)
  • Search including “best practices”

Session

We had a great time as always, started with some chit chat talking about the new flamant Macbook that AirCrewMentor got and wich one I am using right now (no new Macbook for me until I can pay it out of this).

We went over the table that AirCrewMentor has for work that allows him to stand up, really good choice since this work tie you up to the table, I’ll have to look into that as well. (again same situation thatn the Macbook).

Then we started with JS, here I failed since I got nothing ready for the class, so I failed this week the objectives we put last week, not good, however I did gave it a long tought and I ended up with the conclussion that my lowest level is right now in the communication between HTML (AKA: the Markup) and the JS.

So we decided to deep a little onto event handlers, on this particular case we went over the onclick applied to a button.

And we linked the JS file to the HTML, discussed a littel about the best practice to include the JS file at the bottom of the body into the HTML page, so it allows to load first the webpage and later the JS so we get no delay loading the html because we are loading JS.

Sometimes it is impossible to include it at the bottom, so we have to put it into the head so we need to add a load event to it.

Here is the code we used for the example JS:

function startListeningEvents() {
var button = document.getElementById("salute");
button.onclick = handleSalute;
}

function handleSalute() {
console.log(arguments);
}

window.addEventListener("load", startListeningEvents)

So we needed this last line for the code to work, otherwise wasen’t linked to the button id and the method wasn’t working.

when looking for functions like the addEventListener, at the Mozilla Developer page we have the most accurate information and if we take a look at the bottom we can see the “Browser compatibility” that helps us to know if we can use it wisely.

A got tip that came out during the session was to do the searches using the “best practices” looking to get the best way to do what we are going to do.

Objectives Next Session

  • Continue with the Head First Book (now starting chapter 4)—
As always, thanks for your time AirCrewMentor. I am very grateful. 🙂
Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s