Word and keywords

  • Words which are not denfined and not reserved for javascript language that are not understandable by compiler called words.
  • The reserved set of words that are understood by the javascript compiler called Keywords. we cannot use them, it will cause an error.

Variables

  • The place to store data and referred back with the name defined, they are like data containers to store data.
  • in javascript we use var let and const keywords to declare variables.
  • variable declaration & assignment.
  • var a; this is called declaration; a=12; this is called assignment.

Differnce between var and let

  • var variables are ES5 and let, const variables are newly added ES6 features.
  • var variables can be added to the window object by itself; where as let variables will not added to the window.
  • var varibles are function scoped; where as let variables are braces {},(),[] scoped.
  • var can be hoisted ; let will not hoisted.
  • var variables can be re-declared without any error;

declaration and assignment

  • declaring a variable called declaration var number and assigning with = assign operator is called assignment number = 12.

undefined and not defined;

  • variables declared but not assigned any value called undefined and varibales not delcared called not defined.

Hoisting

  • variables and functions are hoisted,their declarations will goes top of the code.
  • var Variables declartion code will move to top.

Types in JS

  • Primitives
  • Number,String,Boolean,Null,undefined,symbol
  • immutable values cannot be changed or copied
  • if there are no brackets then they are primitives.
  • Non-Primitives or Referrences
  • arrays,object,sets
  • if there are any kind of brakcet then they are called reffernces.

conditionals

if else and else if are conditionals in javascript.

  • if is conditional check only executes when the conditon turns true;

  • else if this will re-runs the conditionals and checks conditions and returns only if it is true;

  • else this will be the default if everything turns false this will be executed.

Loops

  • for loop & while loop
  • loops will repeat the iterations desired number of times.
    • for loops will be initiated with the initial variable and there will be a check conditional

Functions

  • there are 2 steps in functions;

  • function declaration and function calling

  • the set of code wants to re-use whenever we needed.

Parameters and arguements

  • in functions parenthesis () a placeholder values is placed to get the value as input called parameter
  • the value which we give to modify the function called arguments.

Arrays

  • list of values called elements; can hold any type of values
  • arrays are indexed from 0

objects

  • objects are set of variables and functions stored as key- value pair.