javascript

Javascript Functions

Javascript Functions

Introduction Functions are one of the fundamental building blocks in JavaScript. Functions help modularize the code by splitting them up. All functions in JavaScript return a value. Even those that do not have a return statement. If you call a function that has no return statement, the returned value would be undefined. Returning a value explicitly, function info(){ return "Hello World"; } var a = info(); console.log(a);// Prints `Hello world` No return statement, but returns undefined anyway,
Understanding Scope and Closure in Javascript

Understanding Scope and Closure in Javascript

Introduction Scope determines the visibility of variable, functions and objects in your JavaScript code. If you forgot to declare some object and try to access it’s property, it is with the help of Scope that JavaScript knows that what you are trying to do is illegal and throws an exception. Understanding Scope is extremely important in creating error free code. Also they are building blocks in understanding advanced concepts such as Closure.