destructuring Flashcards

1
Q

Destruction

const obj = {first: ‘adam’, last: ‘cadieux’, age: 45};

instead:

const f = obj.fisrt;
const l = obg.last;
A

const {first:f, last l} obj:

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Destruction

const obj = {first: ‘adam’, last: ‘cadieux’, age: 45};

instead:

const f = obj.fisrt;
const l = obg.last;
A

const {first:f, last l} =obj:

or even
const {first:, last } =obj:

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Destruction Array

const arr = [‘a’,’b’];

const x =arr[0];
const y =arr[1];
A

const [x,y] = arr;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly