JavaScript Variables

JavaScript Variables have three types of scope:

  1. Global – a global variable can be accessed from anywhere in the code. by default it is global if nothing specify.
  2. Local- a local variable will be visible only within a function.
  3. Const – declare a constant. Once assigned value, it cannot be reassign. if tried to reassign, it will give TypeError: Assignment to constant variable

JavaScript Reserved Words

  • Below table list of all the reserved words in JavaScript are given in the following table.
  • These cannot be used as JavaScript variables, functions or any object names.
abstractelseinstanceofswitch
booleanenumintsynchronized
breakexportinterfacethis
byteextendslongthrow
casefalsenativethrows
catchfinalnewtransient
charfinallynulltrue
classfloatpackagetry
constforprivatetypeof
continuefunctionprotectedvar
debuggergotopublicvoid
defaultifreturnvolatile
deleteimplementsshortwhile
doimportstaticwith
doubleinsuper

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top