Array Matching in Javscript

Array are objects in JavaScript. You can look at like this
var arr1=[1,2,3];
console.log(typeof arr1); //"object"
In javascript, comparing objects (incl. arrays) against one and other they are only compared by reference - i.e. arr1 == arr2 will only be true if they are the same array. Two separate arrays/objects that look the same are not compared by value.
To make it clearer; only the primitive values can be compared for equality - i.e. boolean, string, number. The special values null and undefined also act this way.
var arr1 = [1];
var arr2 = [1];
var arr3 = arr1;

Es 6 Destructuring assignment

Es 6 has new amazing feature Destructuring assignment. The destructuring assignment syntax is a JavaScript expression that makes it possible to extract data from arrays or objects into distinct variables.
var a, b, rest;
[a, b] = [1, 2];
console.log(a); // 1
console.log(b); // 2

({a, b} = {a:1, b:2});
console.log(a); // 1
console.log(b); // 2

Pages