I'm using some destructuring like this:
const { item } = content
console.log(item)
But how should I handle content === undefined
- which will throw an error?
The 'old' way would look like this:
const item = content && content.item
So, if content
is undefined -> item
will also be undefined.
Can I do something similar using destructuring?