Simplifying function hoisting in JavaScript

To understand function hoisting, let us start by considering the code listed below:In any other programming language, the output here would be a reference error. However, in JavaScript you will get undefined as the output. Why? Because JavaScript hoists variables at the top of the execution context. An execution context could be the function inContinueContinue reading “Simplifying function hoisting in JavaScript”

What is the arguments object in a JavaScript function?

A JavaScript function has array-like objects called arguments which correspond to the arguments passed to the function. All arguments passed to a JavaScript function can be referred using the arguments object.  Now as we get started, let’s consider the code listed here:In the above function, num1 and num2 are two arguments.  You can refer toContinueContinue reading “What is the arguments object in a JavaScript function?”

What is a Default Parameter in a JavaScript function?

A JavaScript function can have default parameters values. Using default function parameters, you can initialize formal parameters with default values. If you do not initialize a parameter with some value, then the default value of the parameter is undefined. While calling function foo, you are not passing any parameter, so the default value of variableContinueContinue reading “What is a Default Parameter in a JavaScript function?”

What is the Rest Parameter in a Function?

Learn full article on Infragistics blog A JavaScript function can take any number of parameters. Unlike other languages like C# and Java, you can pass any number of parameters while calling a JavaScript function. JavaScript functions allows unknown number of function parameters. Before ECMAScript 6, JavaScript had arguments variable to access these unknown or variableContinueContinue reading “What is the Rest Parameter in a Function?”

What is “let” statement in JavaScript?

Using the let statement, you can create Block scoped local variables in JavaScript. The let statement was introduced in the ECMAScript 6 standard of JavaScript. Before ECMAScript 6, JavaScript had three types of scoping: Global scoping Functional scoping Lexical scoping To explore let statement in detail, consider the code snippet given below: https://gist.github.com/debugmodedotnet/d7bb15f004965cb03ff532e19680195f You willContinueContinue reading “What is “let” statement in JavaScript?”

Join free webinar on “Step by Step Getting Started with Angular 4”

On behalf of Infragistics , I am hosting a free webinar on “Step by Step Getting Started with Angular 4”. To attend register here . I invite you to attend this webinar on 20 July 2017 Thursday at 11 AM. This is an opportunity for you to learn Angular 4 application development from comfort ofContinueContinue reading “Join free webinar on “Step by Step Getting Started with Angular 4””

undefined and null in JavaScript

Have they ever asked you? “Can you explain null and undefined in JavaScript?” This question is very trivial but important. As a JavaScript developer, you must have absolute understanding on undefined and null. Let us start by looking at code below: https://gist.github.com/debugmodedotnet/62fc783b3dd79f3feec4b6c87f04d077 Output of above code listing would be “undefined” as shown in the imageContinueContinue reading “undefined and null in JavaScript”

How to create a Class in JavaScript

Have they ever asked you that “How you create class in JavaScript?” I am sure, regardless level of JavaScript interview; you must have come across this question. Well, there is no one answer of this question. However, before you go ahead and read detailed answer in this post, let me give you a gist inContinueContinue reading “How to create a Class in JavaScript”

How to create constants in JavaScript?

Constants are immutable variables which value cannot be changed. Once, you have created a constant, its value cannot be changed. While coding in JavaScript, many times you may have come across a requirement to create constants. Before ECMA Script 6, it was not very easy to create constants in JavaScript. In this post, I willContinueContinue reading “How to create constants in JavaScript?”