Do you want BuboFlash to help you learning these things? Or do you want to add or correct something? Click here to log in or create user.



Tags
#javascript
Question

How to get bar out of cagingIt using destructuring?

let cagingIt = {
  foo: {
    bar: 'Nick Cage'
  }
};
Answer
let { foo: {bar: name} } = cagingIt;

console.log(name); // "Nick Cage"

In this example, foo is referring to the property name "foo". Following the colon, we then use barwhich refers to the property "bar". Finally, name acts as the variable storing the value.

Consider that destructuring is not null-safe so it is risky to use this way.


Tags
#javascript
Question

How to get bar out of cagingIt using destructuring?

let cagingIt = {
  foo: {
    bar: 'Nick Cage'
  }
};
Answer
?

Tags
#javascript
Question

How to get bar out of cagingIt using destructuring?

let cagingIt = {
  foo: {
    bar: 'Nick Cage'
  }
};
Answer
let { foo: {bar: name} } = cagingIt;

console.log(name); // "Nick Cage"

In this example, foo is referring to the property name "foo". Following the colon, we then use barwhich refers to the property "bar". Finally, name acts as the variable storing the value.

Consider that destructuring is not null-safe so it is risky to use this way.


Summary

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

Details

No repetitions


Discussion

Do you want to join discussion? Click here to log in or create user.