Javascript

How to use destructuring in Javascript

Destructuring in javascript is a syntax enhancement. It enables us to extract properties from object and create a dedicated variable for them. In this post, we will learn how to use destructuring in javascript to make the code more readable and concise. How to destructure an object in Javascript Lets create a simple javascript object person as follows: Without destructuring,…

Read More

Javascript

Understanding pass by reference and pass by value in Javascript

A variable with primitive data type is passed by value in javascript. All non-primitive data types such as arrays and objects are passed by reference in javascript. Following are the examples of primitive data types in javascript: All above primitive data types variables are passed to functions by their values. Let’s understand this with some code examples. Pass by value…

Read More

Javascript, NodeJS

Understanding null coalescing and ternary operator with truthy and falsy values in Javascript

Understanding how javascript evaluates different values as truthy or falsy is an essential need in day to day coding. Truthy and falsy values in javascript are used in if blocks, ternary and OR (||) operators and null coalescing (??) operator. To understand truthy and falsy values in javascript, we will declare multiple variables of different types. To check for exact…

Read More