Getting Started with JavaScript – A C# Perspective

Peter’s Gekko : Pragmatic OOP in JavaScript

Getting started is no big deal. At first sight you just start typing ahead pretending to write in C#. But there is no compiler or unit testing to validate your work; not until the code is interpreted at run time. As you can do horrible things in JavaScript it does take a lot of discipline to write good code. Also because the language itself is not as strict as C#. The following snippet of code will run.

``function fCheckId CheckId()

{

if (text1.value != “")

{

Id = text1.value;

}

else

{

id = -1;

}

return id;

}

This is an interesting article on JavaScript. It’s the first I’ve seen that attacks JavaScript from a programmer’s point of view. To be specific, from a C# programmer’s point of view. Peter goes step by step and compares JavaScript to C#. I speaks about Objects, Methods, Overloads, Properties, Static Members, and Inheritance.

I think that JavaScript has gotten a bit of a stigma attached to it because of its name. People tend to perceive it more as a scripting language. Although its primary purpose is scripting we should not underestimate JavaScript. Used properly, with the enlightenment that Peter has given, JavaScript can be very powerful.