
First a caveat: JavaScript is a prototype-based language, not an object-oriented language. Now that we have an understanding of that very important fact, let’s learn how to use JavaScript as if it were object-oriented.
A few weeks ago, I was asked to teach a couple of my colleagues how to code with JavaScript. We’re building a cross-browser plug-in that’s meant to interface with an external device. The plug-in itself is written in C++, but the entire API is written in JavaScript. I was right at home, making API calls from within the scripts that drive the web-based UI. But my colleagues weren’t. Their first pass at converting their code from a real object-oriented language to JavaScript was … well … frightening. [Read more...]

