Skip to main content

JavaScript

  Content

  • Introduction
  • alert (alert("It's is an alert!!")
  • Hello JavaScript ()
  • Comments (for commenting single line select the section the "ctrl+/" or double slash(e.g;-> //Hello world), for commenting on multiple lines (e.g;-> /*Hello world*/))
  • Variables--- There are 3 keywords when it comes to variables (var
  • Constants
  • Keywords
  • Datatypes
  • Function---Normal Function, Expression Function, Function Parameters & arguments, Return value from function, Arrow function, Methods & functions, Foreach method.

Variables 

    There are 3 keywords when it comes to variables (var, let, const)


Example-1>  var x=10;
                      console.log(x); -------F12---console----output:10

Example-2> var x=10;
                     console.log(x);
                     var x=15;
                     console.log(x);  
                     x="Amya";
                     console.log(x);--------F12--console---output:10
                                                                                            15
                                                                                             Amya

Example-3>  let x=10;
                      console.log(x); -------F12---console----output:10

Example-4> let x=10;
                     console.log(x);
                     let x=15;
                     console.log(x);  
                     x="Amya";
                     console.log(x);-----------------F12--console--10
                                                                                            15
                                                                                            Amya


Example-5> const x=10;   //const means constant
                     console.log(x); ------------F12--console---output:10

Note:- If you want to fix the value of the variable x to 10 then use "const"

Example-6> const x=15;
                     console.log(x);  
                     const x=20;
                     console.log(x); -------F12----console---output:15
                                                                                              error


Example-7> const x=13;
                     console.log(x);  
                     const x="Amya";
                     console.log(x); -------F12----console---output:13
                                                                                              error



Keywords


Variable->>> var, let, const
Conditional or Decision making->>> If, else, 
Loop->>> For, While, do-While, Break, Continue
Switch->>> Switch
Function->>>Function, Return, 


awaitbreak***casecatchclass
const***continue***debuggerdefaultdelete
do***else***enumexportextends
falsefinallyfor***function***if***
implementsimportininstanceofinterface
let***newnullpackageprivate
protectedpublicreturn***superswitch***
staticthisthrowtrytrue
typeofvar***voidwhile***with
yield






















































































Comments