« Casing the Startup Joint | Main | Jason Fried: Things We've Learned at 37signals »
September 16, 2008
John Resig: Secrets of JavaScript Libraries
Listening to John Resig speak at NYC Web 2.0 Expo on JavaScipt.
Prior to starting John reiterates several times that this is a technical session, talking about functions, closures, and prototyping in JavaScript. John uses a series of pages he built to follow along with, at http://ejohn.org/apps/learn/ (works in Firefox and Safari). If you double click on any of the JavaScript, it becomes editable. You can make changes and then press run. How cool is that?
This presentation talks about advanced JavaScript techniques, but doesn't delve into cross-browser techniques. Not a lot of good documentation on how different browsers run JavaScript, will be in John's next book.
John is good at handling questions, from folks with a spectrum of JavaScript understanding. Impressive on-the-fly modification of the presentation to provide details about the examples. Clearly knows his stuff.
The presentation has periodic quizzes, which John lets you fiddle with the code in your browser and see if you can implement something he's gone over.
Some specifics (not 100% on the terminology for all of these concepts):
- named functions can be defined anywhere, even if the code is not reached
- if you assign a function to a variable, the function can be called by it's native name within the function block, but outside can only be called by it's assigned name
- a function can be assigned as a value to key in an object
- arguments.callee is an interesting way to do recursion, arguments.callee refers to the function currently being executed
- objects and functions can have properties assigned - useful for caching
this.within a function but not part of an object refers to the global contextthis.within an object that's a property of a function refers to the context of the functionobject.constructoris a way to get at the function that was originally used with new to create an object- John doesn't refer to
new function()as creating a class. It's "like a class", in a roundabout kind of way
Sadly, I had to slip out at the break to look at some work issues.
Posted by mike at September 16, 2008 1:33 PM