JavaScript Tutorial

Javascript Introduction

JavaScript (js) is a light-weight object-oriented programming language which is used by several websites for scripting the webpages. It was initially created to “make web pages alive”. The programs in this language are called scripts.

They can be written right in a web page’s HTML and run automatically as the page loads. They are provided and executed as plain text, don’t need special preparation or compilation to run.

JavaScript consists of three main parts:-

  • ECMAScript that provides the core functionality.
  • The Document Object Model (DOM), which provides interfaces for interacting with elements on web pages
  • The Browser Object Model (BOM), which provides API for interacting with web browsers.

JavaScript allows us to add interactivity to a web page. It is often used with HTML and CSS to enhance the functionality of a web page such as validating forms, creating interactive maps, and displaying animated charts.


Client side V/s Server Side Javascript

When JavaScript is used on a web page, it is executed in the web browser of user’s computers. In this case, JavaScript works as a client-side language.

JavaScript can run on both web browsers and servers. A popular server-side environment for JavaScript is Node.js.

Unlike the client-side JavaScript, the server-side JavaScript executes on the server that allows us to access databases, file systems, etc


Javascript History

  • In 1993, Mosaic, the first popular web browser, came into existence.
  • In the year 1994, Netscape was founded by Marc. He realized that the web needed to become more dynamic. 
  • Consequently, in 1995, the company merged with Sun Microsystems for adding Java into its Navigator so that it could compete with Microsoft over the web technologies and platforms.
  • Now, two languages were there: Java and the scripting language. Further, Netscape decided to give a similar name to the scripting language as Java's. It led to 'Javascript'.
  • Finally, in May 1995, Marc coined the first code of Javascript named 'Mocha'. Later, the marketing team replaced the name with 'LiveScript'.
  • Due to trademark reasons and certain other reasons, in December 1995, the language was finally renamed to 'JavaScript'.

Applications of Javascript

  • Web Client-side validation
  • Displaying pop-up windows and dialog boxes (like an alert dialog box, confirm dialog box and prompt dialog box)
  • Displaying clocks
  • Dynamic drop-down menus
  • Displaying date and time
  • Creating presentations
  • Backend Data Loading

This list goes on, there are various areas where millions of software developers are happily using Javascript to develop great websites and others softwares.


Features of Javascript

  • All popular web browsers support JavaScript as they provide built-in execution environments.
  • It follows the syntax and structure of the C programming language. Thus, it is a structured programming language.
  • It is a case-sensitive language.
  • It is a weakly typed language, where certain types are implicitly cast (depending on the operation).
  • It is supportable in several operating systems including, Windows, macOS, etc.
  • It is an object-oriented programming language that uses prototypes rather than using classes for inheritance.
  • It is a light-weighted and interpreted language.
  • It provides good control to the users over the web browsers.