Javascript Tutorial


Javascript is a scripting language(supports scripts) for Web pages but it is also used in non-browser environments as well. It is a powerful, lightweight, interpreted, scripting language with first-class functions (i.e. the language supports passing functions as arguments to other functions).

In order to add the dynamic interactivity to web pages Javascript is embedded within Hypertext Markup Language (HTML). Since it runs on the client side of the web so it can be used to design / program how the web pages behave on the occurrence of a particular event. That’s the reason why it is widely used for the behaviour of the web pages.


When to use Javascript? :

You should use JavaScript when the task cannot be accomplished with any other technology. If it can be done in another language, it should be done in another language.

JavaScript is used to create interactive web-pages and web-apps. It is used for:

  1. Client-side form validation.
  2. Dynamic drop-down menus, sliders
  3. Displaying clocks, data and time
  4. Fade things in and out, animate sizes and positions.
  5. Displaying popup windows and dialog boxes (like alert dialog box, confirm dialog box and prompt dialog box).
  6. when you want to perform any action on events like clicks, double clicks, mouse enters, mouse exits, key presses, browser window resizing, scroll,...and the list goes on.

Advantages of using Javascript:

  1. Javascript is executed on user’s computer, meaning is that,whatever you do in Javascript will not add any processing strain on server.and that’s why it is called as the client-side programming language. And this feature makes your sites responsive for the end user and less expensive for you in terms of server traffic.
  2. With the help of Javascript you can create highly responsive interfaces which will improve the user experience and provide dynamic functionality, without waiting for the server to show another page.
  3. If you want to make online systems available offline and sync automatically once the computer goes online, then Javascript is the best technology you can use. you can do this using the right browser add-ons (Such as Google or Yahoo Browser Plus).
  4. Content loading and changing it dynamically. Using Ajax in Javascript you can load content into the document if and when the user needs it, without reloading the entire page.
  5. Using the Principles of unobtrusive JavaScript(defensive Scripting), JavaScript can test for what is possible in your browser and react accordingly.


Intresting facts about Javascript:

  1. JavaScript works on web users’ computers — even when they are offline!
  2. JavaScript is the world’s most popular programming language.
  3. World’s most misunderstood programming language.
  4. JavaScript will be used as long as people use the internet".
  5. JavaScript is also known as Mocha, or LiveScript, or JScript, or ECMAScript.
  6. Virtually every personal computer in the world has at least one JavaScript interpreter installed on it and in active use.
  7. Javascript popularly known as a Client Side language, but you can even send Server request with it.
  8. With the popularity of Node.js, it can be used as both frontend and backend programming language, JavaScript has become a full-stack language.
  9. In JavaScript, NAN (Not a Number) is of type Number. Unbelievable, isn't it?
  10. JavaScript is the most-used programming language on Github.

  • Print Page