Introduction to JavaScript and its Variables

Introduction to JavaScript and its Variables

Arun R's photo
Arun R
·Feb 15, 2023·

3 min read

You would have come across the word “LinkedIn “ at least once, LinkedIn is a platform that works on websites and mobile apps in business and employment-focused methods. LinkedIn usually releases Emerging Jobs reports across the globe and in specific countries. In this case, let's focus on India where out of 10 Emerging Jobs in India, 5 Emerging Jobs in India use Javascript. In this article, we will go through What is Javascript and its uses, the Types of variables in Javascript and Finally, the difference between var, let and const in detail.

History of Javascript :

Javascript is everywhere today and it's the most trending language to learn in the tech world, Javascript has become one of the most mandatory skills for a developer, Back in 90’s when the Internet started becoming popular, Initially, the web was more text-heavy and images over the left and right corners of headers that weren’t exciting nah, A company called Netscape communication came up with a first commercial web browser and it's a hit soon after they wanted the web to be livelier and a dynamic and they believed that HTML needed a Scripting language which could run natively in a browser and implementing some functionality to a website and they came up with a new programming language names “Mocca” which is the earlier name of the giant “Javascript” today.

What is Javascript?

Javascript is a programming language that directly runs in a browser and it's a front-end programming language where you can perform logical operations, It is a high-level interpreted programming language that helps to make web pages more interactive and add live motion to the website, Javascript doesn’t require a compiler to execute output as we do in C and Java, Javascript can run in our browsers like Google Chrome, Edge, Brave browser Etc…

Types of variables in Javascript?

Think about why we need variables. The most important thing in any technology is all about information like getting input and processing output, and the ultimate aim is to store the information somewhere and there come the variables. In Javascript we use three different ways to declare the variable using var, using const and using let for executing our programming operations. In simple terms, we use variables to store values inside a program.

Difference between var let and const?

JavaScript keywords add an extra layer of intricacy to the language. The major differences between them are based on scope, hoisting and reassignment.

Var :

In Javascript Var keyword comes under Function scope, Var can be hoisted, reassigned and redeclared

Here in this example we first assign var as empty and its output will be like Undefined we reassign it with the city name as Coimbatore the output will be Coimbatore.

var city

console.log(city)  // undefined

var city = "coimbatore";

console.log(city) // coimbatore

var name = "Arun";

console.log(name) // Arun





In Javascript Let keyword comes under Block Scope, Here Let keyword can’t get hoisted and it can be reassigned but can’t be redeclared


It shows an error due to the 'source' being called even before the initialization

console.log(source)  //   ERROR

let source = 'chennai'

console.log(source) // chennai


ERROR / Chennai

The console.log(source) is declared before the initialization.


In Javascript, the Const keyword comes under block scope where we aren't able to hoist, reassign and redeclare.


 //console.log(destination) // ERROR

 const destination = "Goa"

 console.log(destination) // Goa

Output :


Cheatsheet to know the difference between var let and const.


Concluding with, I hope you have got a clear understanding of Javascript and the Difference between var let and const in detail, Kindly share your views in the comment section.

Also, Read our article:

Did you find this article valuable?

Support Skill Safari by becoming a sponsor. Any amount is appreciated!

Learn more about Hashnode Sponsors
Share this