Tuesday, April 1, 2014

Rules of Javascript, RegEx, and more, oh my!

Another day at Coder Camps, another huge upload of info into my brain.

What did we learn today?

The first rule of Javascript (at least for us) - Use "use strict"; in all your functions.

We actually learned the second rule yesterday - Always declare your variables at the top of your function.

And the third rule - Always define your functions before you call them.

But wait, there's more!

We discussed the Agile mentality, including a warning that the paradigm has been somewhat diluted in recent years, and had our first stand up meeting.

We talked about RegEx a little early - in working yesterday's coderbyte problems a couple of us, self included, found some RegEx code on stackoverflow that helped us solve the challenges - so even though this might be a bit "advanced" for our level, we got a quick overview and got links to some resources to learn more.

Then we went over version control a la Git and connected Visual Studios to our github accounts. Which transitioned nicely into discussing licensing.

Next it was time for more coderbyte problems (6-10 in the easy category) and pair programing. Which, of course, was a perfect way to practice commit, push, and pull with github. Later on in the program we'll also cover Team Foundation Server.

Oh, not to be forgotten, we went over how you can return a function and thereby gain access to it's scope outside of the normal boundaries set by Javascript. My first question was - okay you return the function and assign it to a variable, then you change the value of a variable inside the scope of that original function, then call the function held in your new variable to access that variable. Will you get the value that existed when you assigned the new variable, or will you get the current value assigned in the meantime? Answer - you get the current value.

Okay, if you don't code, you probably didn't follow that. My apologies, but translating concepts like this into day to day english may take me some time, more text than I'm prepared to write currently, and may not really interest you if you don't like to code. Suffice it to say - its a concept I wouldn't have thought of on my own, and yet, given that functions are first-order objects in Javascript, it makes perfect sense once you see it.

Homework is done for the day, well almost done, I just realized when writing this that I didn't follow the first rule of Javascript when I wrote my functions today, so a few quick edits to make then maybe I'll look into RegEx some more &&/||* read some javascriptissexy.com.

* - && = "and" || = "or"

No comments:

Post a Comment