Javascript Overview

What is Javascript?

JavaScript is an object-oriented scripting language designed to be embedded in HTML pages for added interactivity and offer intelligence to web pages. JavaScript provides a set of objects (Array, Date, and Math), language elements (Operators, Conditional Controls, and Statements). Javascript is primarily used in client-side to control the browser elements and HTML Document Object Model (DOM) to offer interactivity to users.

Many novice webmasters confuse JavaScript with Java, and use the term incorrectly. Javascript is NOT the Java Programming Language. Javascript was originally developed by Netscape Communications, while Java was developed by Sun Microsystems. Javascript is a weakly typed "script" language, whereas Java is a strongly typed programming language which compiles a source code to produce a binary byte-code. Think of those two as a completely different programming language.

Facets of Javascript

Javascript is a client-side scripting language primarily run on web browsers. Here are important facts, and best practices about using Javascripts.

  • Javascript is a case sensitive language.
  • Javascript "type" attribute is not longer required attribute in HTML 5.
  • Keep them separate from the webpages, and store them in an external file.
  • Placement of javascript matters, and the best practice is to place them at the very bottom of the web page before closing <body>tag unless you need to run them early.

Why use JavaScript?

Before Javascript, adding interactivity to web pages was very difficult. Collecting, processing and validating user data required server-side programming, which requires submission of the form each and every time. With JavaScript, user data collection and validation can be done on client-side without the form submission to the web server reducing server resource overheads. JavaScript can also add interactivity to the webpage by manipulating HTML DOM elements.

What can JavaScripts do?

JavaScript is a client-side scripting (or "interpreted") language that runs on the visitor's computer.

  • Web Designers can use JavaScript "snippets" to add interactivity to HTML pages. Web Designers are not generally programmers, but a snippet of JavaScript code can be cut-and-pasted onto HTML pages to offer programmability to web pages.
  • With JavaScript, web designers can control and manipulate HTML DOM elements. An ability to control DOM gives web designer a full control of HTML objects (elements), and create and modify objects dynamically.
  • Web Designers can use JavaScript to make the web react to user initiated events. Upon user initiated events such as a click on an HTML element or on submit of a form, a JavaScript code can be executed to perform dynamic action.
  • JavaScript can be used to validate a form data before submitting to a web server.
  • JavaScript can be used to detect web browser, and client-side characteristics.
  • JavaScript can be used to create cookies on the visitor's computer.




Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.