• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL

Introduction > JavaScript Pros

JavaScript Pros

No one language or technology has the market cornered as the best solution for developing web applications. Each has its pros and cons. Recent advances in JavaScript and other proliferating technologies, such as DHTML, Java, and even Macromedia's Flash, have positioned JavaScript to capitalize on these tools and create relatively powerful web solutions. Here are some other reasons that argue strongly for developing applications in JavaScript.

Easy to Learn, Quick, and Powerful

Since JavaScript is fairly easy to learn, you can begin using it right away. This is perfect for adding some quick functionality to a site. Once you have the basics down, creating full-featured applications isn't much further away.

JavaScript also rates as pretty powerful for a high-level language. You can't do anything at the machine level with it, but it does expose many features of browsers, web pages, and sometimes the system on which the browser is running. JavaScript doesn't have to be compiled like JavaTM or C, and the browser doesn't need to load a virtual machine to run the code. Just code it and load it.

JavaScript also works from an object-oriented architecture similar to Java and C++. Features such as constructor functions and prototype-based inheritance add a layer of abstraction to the development schema. This promotes much greater code reusability.


JavaScript is by far the most popular scripting language on the Web. Not thousands, but millions of web pages around the world contain JavaScript. JavaScript is supported by the most popular web browsers (though we're really talking about JScript in MSIE). Both Netscape and Microsoft seem to be continuously seeking ways to extend the language's functionality. This kind of support means that JavaScript stands a better chance of being supported by the vast majority of browsers used by your web site visitors.

Reducing the Server Load

This was one of the first reasons that web developers adopted JavaScript. It can perform many functions on the client side that used to be handled strictly on the server. One of the best examples of this is form validation. Old-school coders might remember back just a few years when the only way to validate user input of an HTML form was to submit the user information to the web server, then toss that data to a CGI script to make sure the user entered everything correctly.

If the data had no errors, the CGI script processed as normal. If errors were encountered, the script returned a message to the user indicating the problem. While this is one solution, consider the overhead involved. Submitting the form requires another HTTP request from the server. That trip across the Net is also followed by executing the CGI script again. Each time the user makes a mistake in the form, this process repeats. The user has to wait until the error message arrives to learn of the mistake.

Enter JavaScript. Now you can validate the elements of a form before the user sends it back to the web server. This reduces the amount of transactions via HTTP and significantly reduces the chance of user error with the form input. JavaScript can also read and write cookies , an operation once performed exclusively by the header-setting power of the web server.

JavaScript Is Growing

When JavaScript 1.1 came out, there was mass hysteria because of the new things called the Image object and the document.images array that let us create image rollovers. Then JavaScript 1.2 hit the scene. The floodgates were wide open. DHTML support, layers, and a slew of other enhancements bowled over many coders. It was too good to be true.

It hasn't stopped there. JavaScript has since become the design model for EMCA-262 , a standardized general-purpose scripting language. At least one company has developed an environment that runs JavaScript from the command line. Macromedia has incorporated custom JavaScript calls in its Flash technology. Allaire's ColdFusion has integrated JavaScript into its XML-based technology, Web Distributed Data Exchange (WDDX). JavaScript is getting better and better. More features. More options. More hooks.

Maybe You Have No Choice

Sometimes it's the only way. Suppose your ISP doesn't allow CGI scripts to be executed. Now what are you going to do if you want to add that forms-based email or take advantage of cookie technology? You have to look to client-side solutions. JavaScript is arguably the best one for adding server-side functionality to a "client-side only" web site.

There Are Probably More

I can think of a few more advantages, and you could surely add to the list. The point is: in spite of the advantages of server-side technology, JavaScript applications have their place on the Net.

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint