It allows a function to access variables from a enclosing scope or environment even after it leaves the scope in which it was declared.

function democracy() {

let india = “india”;

return function usa() {

let america = “america”;

return function sauth() {

let africa = “africa”;

return `${india} >…

It is convenient way to extract multiple values stored from arrays and object.
It makes possible to unpack values from arrays and properties from object.

const course = {
courseName: “JavaScript”,
duration: “Six Months”,
tutor: “Salman”

function india({courseName,duration, tutor}) {
console.log(courseName); //JavaScript
console.log(duration); //Six Months
console.log(tutor); …

Mohammad Salman

Software Engineer. Open Source Enthusiastic

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