BlogPost_205

let obj = {
myVar: 'foo',

myFunc: function() {
console.log(this.myVar)

setTimeout(function() {
console.log(this.myVar)
}, 1000)
}
}obj.myFunc() // foo ... then... undefined

Create an array

let myArr = [10,20]

Then you destructure it

const [a,b] = myArr

console.log(b)

// logs 20

--

--

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