DEV Community

Arul perumal
Arul perumal

Posted on

Java Script Intro

** JAVASCRIPT INTRODUCTION**

java script is the worlds most popular programming language
java script is easy to learn
java script is used to create interactive and dynamic webpages.
it is responsible for adding functionality to a website and allow for user interaction with the website content
let discuss about

Variable

Variable are containers for storing the information or data
Example;
var a=10
var b=20
console.log(a+b)
output is =30
in above program a and b are the variable,10 and 20 are the integer data

Javascript variable can be declared in three ways
1.using Var
2.using Let
3.Using Const

Var KeyWord

It is accessed for both function Scope or global Scope
Var a=10
{
var b=20
}
console.log (b)
output is =20(accessible outside the scope)

Let Keyword

  • the let keyword introduced in 2015
  • let keyword must be declared before use.
  • let keyword can not be re declared
  • let keyword have block scope let keyword cannot do this let num=" hello" let num="100" let keyword has block scope { let x=2; } X cannot be used here

Const Keyword

In javascript the const keyword is used to declare a constant variable, once assigned a value , cannot be reassigned or re declared.it provided a way to create variable that are meant to be immutable

const keyword cannot do this
Const num=10
num=20

Top comments (0)