JS Introduction

JavaScript

Next →

In this tutorial we will learn about JavaScript.

What is JavaScript?

JavaScript or JS is a dynamic programming language that we use in HTML document to add dynamic interactivity.

Brief history

The language was given the name Mocha then it was renamed to LiveScript when NetScape and Sun Microsystem did a license agreement. Then the name was later changed to JavaScript.

When this langage was submitted for standardization to ECMA International it was given a standard name ECMAScript.

Even Microsoft back then created their own version called JScript for their browser.

JavaScript is not Java

Though JavaScript has some similarities to programming language like Java and others like C and C++. And it was given this name to attract developer at that time.

How to run JavaScript?

Code written in JavaScript runs on client side i.e., the web browser. We don't have to compile JavaScript code.

Requirement

In order to learn and practice JavaScript we will need some softwares.

Text Editor: This is where we write the code. Some of the commonly used text editors are Notepad++, Sublime Text, Brackets, Atom, TextMate etc.

IDE: We can also use IDE (integrated development environment) like Eclipse and NetBeans.

Web browser: We will need a web browser like Chrome, Firefox, Safari, Edge etc.

If you want to start without installing any software then you can use HTML Editor of this website.

Prerequisite

You must have some basic knowledge of HTML and CSS.

Click here for HTML tutorial.
Click here for CSS tutorial.

Hello World

Let us begin our journey by printing "Hello World!". Open your text editor or IDE and create a new file and save it as intro.html on your Desktop.

Now inside the file write the following code.

<!DOCTYPE html>
<html>
    <head>
        <title>Intro</title>
    </head>
    <body>
        <script type="text/javascript">

        	document.write("Hello World!");

        </script>
    </body>
</html>

Now open intro.html file in your browser and you will get the following output.

Next →