Wednesday, May 23, 2018

ES5 Java Script

ES5  :-

Javascript file or code should be included in the end of body section of HTML.
tag will detect if javascript is turned of.

Variables :- var variables re dynamically typed.
use strict mode.
typeof will tell data type.

primitive datatype :-  number(int, float), string, boolean
complex datatype :- object (array, json etc), function

Functions can be assigned to variables, can be executed using ().

for -- in  can be used for printing fields of object.

variable name can start with $, _ or letters. Numbers & symbols are not allowed as first letter.

Hoisting :- means two pass compilation process.
                  In Pass1 :- All declarations are located & identifiers are known by compiler.
                  In Pass2 :- Execution occurs. Variables declared after usage also works as they are known to compiler in Pass1.
                  In Hoisting step all variables are assigned 'undefined' value.

Infinity(Number.POSITIVE_INFINITY), -Infinity (Number.NEGATIVE_INFINITY)

string :-- double quotes, single quotes are same.

!!  :- Two NOT convertes variable to boolean.
undefined has type as 'undefined'.
null has type as object.

this === window.          window is global scope.

No comments:

Post a Comment