Posts

Showing posts from March, 2019

Javascript Basic Concepts

Image
Javascript Basic Concepts Function Declarations vs Function Expressions Function Declarations Function declarations define named function variables without the need for variable assignments. Function declarations occur as independent components and can not be nested within non-function blocks. It is useful to think of them as siblings of variable declarations. Function declarations must begin with "function", as variable declarations begin with "var". example :- function testFunction(){   console.log("Hello World"); } To execute this function we can call it as "  testFunction() "  Function Expressions  A function expression defines a function as part of the syntax of a larger expression (usually variable assignment). Functions defined by function expressions can be named or anonymous. Function expressions must not begin with "function" example :-  Anonymous function expression var x = function (){     ...