How to seal, freeze and prevent extension of an object in JavaScript

Read full article on the Infragistics blog In modern JavaScript, objects are integral, and having a strong understanding of topics surrounding objects is necessary for writing better JavaScript. You can create an object in four ways in JavaScript. Read about them in greater detail here. Once you know how to create an object, you may … Continue reading How to seal, freeze and prevent extension of an object in JavaScript

20 JavaScript articles to brush up your JavaScript language

I have been evangelist of JavaScript and Angular for some time now. Below, I am consolidating 20 JavaScript articles written by me. These articles will help you in understanding basic language construct of JavaScript. Topics like objects, hoisting, functions etc. are covered in these articles. Let me know how you find them. 1. How to … Continue reading 20 JavaScript articles to brush up your JavaScript language

How to Count the Number of Properties of the JavaScript Object

While working with JavaScript, I come across a requirement to count a number of properties in a JavaScript object.  I found two ways to find the number of properties in an object. They are as follows: Using for loop Using Object.keys Consider an object, “cat”, as demonstrated below: https://gist.github.com/debugmodedotnet/71a86e81addac19528f75e4591767122 You can find a number of … Continue reading How to Count the Number of Properties of the JavaScript Object

Class in JavaScript

Read full article on the Infragistics blog ECMAScript 6 introduced the class keyword to create classes in JavaScript. Now, you can just use the class attribute to create a class in JavaScript. Before ECMA 6, whenever you called a function using a new operator, the function returned a new object. Therefore, the function was acting as a … Continue reading Class in JavaScript

Simplifying function expressions and the function statement in JavaScript

Read full article on the Infragistics blog In JavaScript, a function can be created in three possible ways: Function as an expression Function as a statement Arrow functions In this post, we will learn about function expressions and the function statement. Consider the following code: https://gist.github.com/debugmodedotnet/e4b1dc967bc51b6c8dd1ff98d8d88dc6 When you create a function as shown above, it … Continue reading Simplifying function expressions and the function statement in JavaScript

What are the Call and Apply Methods in JavaScript

Read full article on the Infragistics blog In JavaScript, the apply() and call() methods execute a function in the context (scope) of the first argument you pass to them. Let’s take a look at them in action to learn more. Say that you have an object person as shown below: https://gist.github.com/debugmodedotnet/11ca4e8d58e602ca93813cef93d9601e And in addition, you have a … Continue reading What are the Call and Apply Methods in JavaScript

Simplifying function expressions and the function statement

Read full article on the Infragistics blog In JavaScript, a function can be created in three possible ways: Function as an expression Function as a statement Arrow functions In this post, we will learn about function expressions and the function statement. Consider the following code: https://gist.github.com/debugmodedotnet/f7f9c0a6e18a62521ad5fd6656adb69e When you create a function as shown above, it … Continue reading Simplifying function expressions and the function statement