skip navigation

« Previous post: Next post: »

P2pu webcraft course: JavaScript 101

by Kai Chan Vong on

The peer to peer university was recently created after lots of discussion around it on the Google groups forums and now is really showing great promise.

I’ve joined 2 groups – the JavaScript 101 and the Ruby on Rails course.

This post is just to focus on the javascript course. I’ve done a good years worth of working with javascript now and possibly 2 and a half years of jQuery. This doesn’t however mean that I’ve grokked every part of it, but I do want to and have been reading tons of books (the Rhino book, jQuery fundaments, secrets of a JavaScript ninja, bulletproof ajax and lots more that I’ll link here through my delicious bookmarks).

The thought of being in a more university environment with lots of people learning really excites me. To get into the course you have to watch a talk by Douglas Crockford who talks about the history of JavaScript (around the time of the Microsoft and Netscape battle) and then talks about the fundamentals.

One of the things I didn’t realise was that JavaScript uses numbers that are 64bit or doubles – known as double precision from the days of Fortran. Which is useful to know that when doing division.

We are then asked to write a simple Javascript program which will print the sum of 2+2 and display the result in an alert window in the browser.

Here is how I tackled the question:


// done quickly just to run the program!
function sumOf(a,b){
c = a + b;
alert(c);
}

sumOf(2,2);

All this work is and will be available on GitHub and the above project can be tested here.