Tutorials Tonight
Follow Us


In this tutorial, you will get a basic introduction to javascript as a programming language. You will learn how to write basic javascript codes, creating variables, using conditions, using loops, etc. We will cover these in detail in the coming sections.

What is Javascript?

Javascript is a scripting language mainly used for programming web applications. It is one of the most popular languages in the world also known as JS.

what is javascript

Programs written in javascript is generally called a script. Javascript can control elements, media, attributes, and other contents on web pages or web applications.

It is mostly used by browsers but many nonbrowser environments also have support for javascript. For example, Node.js is a javascript runtime environment.

Javascript is an interpreted language. It means that the javascript code is executed by the browser and the browser does not have to compile the code into bytecode. This means that the javascript code is executed in real-time. This is a big advantage of javascript over other programming languages like C++, C#, Java, etc.

In frontend development, it is used to make web pages dynamic, create a better user interface, or create some features. It was originally developed by Netscape in 1995.

Javascript is integrated with HTML so it's easy to use. It is a very important language when you are learning web development.

Difference between programming language and scripting language

JavaScript is a scripting language and not a programming language.

Programming languages and Scripting languages are very much similar but they have few differences:

programming language vs scripting language
Programming language Scripting language
Programming languages are compiled into machine language. This means that the code is converted into a sequence of instructions that the computer can understand Scripting languages are interpreted. This means that the code is executed in real-time (at runtime)
Programming languages when compiled that creates an executable file Scripting languages do not create any executable file
Programming languages are used to write applications Scripting languages are used to write scripts and are used to write small applications
Generally, programs in programming languages are written from base scripting language also uses pre-existing modules
maintenance of programming languages is more difficult Scripting languages are easy to maintain
Examples of programming languages are C, C++, Java, C#, etc Examples of scripting languages are JavaScript, Perl, Python, Ruby, etc.

Why learn javascript?

Without javascript, your webpage will be static and unable to perform any task. Using javascript you can program your webpage how to behave on events. When you are learning web development then there are three main languages that you must learn:

  1. HTML - It defines the content of a web page.
  2. CSS - It defines the layout and style of a web page.
  3. Javascript - It provides dynamic behavior to web pages. Interesting facts about javascript

Interesting facts about javascript

  • The first name of javascript was Mocha (codename) which was then changed to LiveScript and finally changed to Javascript in the next three months.
  • Javascript is one most popular programming languages.
  • Javascript was used by Google to build the search engine.
  • Javascript was developed in just 10 days.

Advantages of Javascript

There are many advantages of using javascript. Here are some of them:

  1. Simple - Javascript is a simple language. It is easy to learn and use.
  2. Dynamic - Javascript is a dynamic language. It means that the code is executed in real-time.
  3. Speed - The Client-side Javascript is very fast as it runs immediately on the client-side browser.
  4. Popularity - Javascript is one of the most popular programming languages. The Internet is full of javascript applications.
  5. Frameworks - There are many javascript frameworks available in javascript. These frameworks help you to build your web application faster. Some popular frameworks are React, Angular, Ember, Backbone, Meteor, Polymer, etc.
  6. Reduce server load - Javascript is a dynamic language. It means that the code is executed in real-time. This means that the server does not have to compile the code into bytecode. This means that the server does not have to wait for the code to be executed.

History of Javascript

Javascript was developed by Netscape in 1995. Netscape was one of the first web browsers.

The developer of Javascript was Brendan Eich.

After the release of javascript, it became very famous and Netscape chose ECMA (European Computer Manufacturers Association) to handle and maintain javascript.

ECMA was later renamed W3C and it is now the most popular standard for javascript.

What javascript can do?

Javascript can do a lot of things. Here are some of the most important things that you can do with javascript:

The use of javascript is limitless.

JavaScript Examples

Let's see basic examples of javascript. We will briefly discuss printing output in the console, creating variables, using conditions,s and using loops.

These topics will be discussed in detail in the coming sections, and we will also encounter some more advanced topics.

Printing output in the console

While working with programs you generally need to output something for checking things. In javascript, we use console to output something.

To output something in the console, we use the console.log() function.


console.log("Hello World!");

Creating variable

Variables are used to store data. We need to store the value of things in programming so we can use them later.

In javascript, we use the var keyword to create a variable. We can use this variable to store any value.

We can also use let and const keywords to create variables.


var name = "John";

Using condition

Condition is used to check for certain conditions to execute our code only when that given condition is true. for example, print a number only if it is greater than 10.

Use the 'if' keyword to create a condition. The 'if' keyword is followed by a condition and then a block of code.

We will discuss conditionals in the coming sections.


if (15 > 10) {
  console.log("15 is greater than 10");

Using loops

Loops are used to repeat a block of code multiple times. For example, print a number 10 times.

Use the 'for' keyword to create a loop. The 'for' keyword is followed by a variable and then a condition and then a block of code.

There are also other types of loops in javascript like while loop or do-while loop.


for (var i = 0; i < 10; i++) {

Frequently asked questions

Here are some of the frequently asked questions about javascript.

  1. What is the difference between JavaScript and Java?

    JavaScript and Java are totally 2 different programming languages and there is no connection between them. JavaScript is a dynamic language and Java is a static language.

  2. What is ECMAScript?

    ECMAScript is a programming language specification. It is the specification that defines the language that is used to write web applications.

  3. When was javascript created?

    Javascript was created by Netscape in 1995.

  4. What is the main use of JavaScript?

    Javascript is mainly used in web applications. It is used to create dynamic behavior on the web page.


In this section, we have discussed the basic concepts of javascript. We have also discussed some of the most important concepts of javascript.

Now, let's move on to the next section where we will learn to write our first javascript program.

Before jumping into the next section, you can check out insideApps. It enables you to create several different apps like communication, marketing and management apps. That can either be used on mobile or on your PC.