Figure 1

In the life of day to day programming with javascript, most of the developers need to access items/elements inside objects/arrays. Destructuring comes here to give an easy way to access keys/elements of objects/arrays in javascript. How does the mechanism of destructuring works with arrays & objects?

  1. Object Destructuring

Destructuring an object is assigning values of object keys to a particular declaring variable. Please consider the below object,

const user = {
name: 'Darshana',
country: 'Sri Lanka',
In normal way we can access name and the country of the user by accessing object by it's keys (objectName.key).// to get…

A variable is a container that stores data values in any of the programming languages. In javascript, a variable should be created by using either one of var, let, or const keywords. But for javascript variables, can hold many data types such as String, Number, Array, and Object, etc.

In other words, javascript variables are not directly combined with any particular data type and any of the variables can be assigned and re-assigned apart from the variable type const. Will be describing the reason for it later in this article. …

Darshana Sandaruwan

I am an ambitious and positive person who enjoys taking up challenges in the field of Software Engineering

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store