JS — destructuring assignment

blossom0417
1 min readNov 21, 2018

--

var first = someArray[0]; 
var second = someArray[1];
var third = someArray[2];

#destructuring

var [first, second, third] = someArray;

#2

const hero = document.querySelector('.hero');
const {offsetWidth: width, offsetHeight: height} = hero;

--

--

No responses yet