DEV Community

Akash
Akash

Posted on

Simple Revision of JS

1.What is java script ?

  • It is high level programming language
  • It is also a scripting language
  • Used to make webpages dynamic
  • Used to built websites and web applications

2. Datatypes in JS?

  • Datatypes in javascript can be classified into 2 types

Primitive datatype
Non-Primitive datatype

Primitive datatype

*string
Denotes wordings
(E.g)"Akash","mohandass"

*number
Denotes number
(E.g) 1,2,3,4,5

*big int
Denotes large value
(E.g) 600654789

*boolean
Denotes True or False
(E.g) 10=10 Result:True

symbol
Denotes Symbols
(E.g) %,<,>,
,/

*Null
Denotes No value

*undefined
Denotes variable is there but no value is assigned

*NAN
Denotes value representing Not A Number

Non-primitive datatype

1.Function

  • Function is a reusable code of block
  • It includes set of informations
  • Function means Activity


OUTPUT:BEST OF LUCK AKASH

2.Array

  • Array is used to store a multiple values in single container
  • Array stores value using[]


OUTPUT:60

3.Object

  • Object is a collection of key values
  • Object declare values by {}
  • It includes state and behaviour
  • Object contains another object


OUTPUT: RX100

DIFFERENCE BETWEEN PRIMITIVE AND NON-PRIMITIVE DATATYPE

=>Variables in JS

  • Older Javascript To Declare variable use var(not recommended )
  • Modern Javascript To Declare variable use 1.let 2.const (Mostly Recommended) *If you don't need to change the value of variable use const


OUTPUT=13

  • Var is used before 2015
  • Let and const used later 2015
  • Variables are label for data values

BLOCK SCOPE:Can change fir functional scope
FUNCTION SCOPE: Not change for Block scope

  • Also maintain scope inside function

Above contents referred in MDN and W3 School.

Top comments (0)