My JavaScript Misconceptions

 | 2 min

With the noble intent of thesis procrastination, I spent quite a bit of time at work looking up information about JavaScript. (Actually, some of it was relevant to creating the web survey for my thesis, but I probably went overboard). I've learned quite a lot, and learned that some of the ideas and impressions I had of JavaScript were actually wrong.

I initially wrote it off as a slackly-typed scripting language, but JavaScript is actually a fully object oriented language. In some ways, it is even more object oriented than the other languages I've worked with: Java, C# & Visual Basic.NET. What throws people (including me) is that is is completely not class-oriented. You can't define a class in JavaScript, but you can take an object and add to it whatever methods and properties you want, at any time. To those of us who learned with class-based, strongly-typed OO, I guess we just don't know quite what to make of this.

The other thing the put me off is the easy availability of scripts on the web, so that you can just copy and paste and add JavaScript into your website. Initially this gave me the impression that JavaScript is a language 'for dummies'. However, I don't think you can get further from the truth. I still don't think I know much about writing good JavaScript, but even I can see that a lot of the stuff available out there is absolutely abysmal code. I think in many ways JavaScript is too powerful - it is very easy to misuse in unskilled hands (which most are).

I had also heard a lot about how unstandardised JavaScript is. It turns out though, that the language itself is very well standardised. However, in the web, one of the primary uses of JavaScript is interacting with the DOM, and therein lies the problem. The DOM is very poorly standardised across the browser platforms, but this is in no way a reflection of JavaScript as a language.

JavaScript is definitely something I want to look into a bit more.

PS QuirksMode is a great source of information on JavaScript and CSS