JavaScript · Junior · Question 60 of 75

What are title and year after this destructuring?

const movie = { name: "Up" };
const { name: title, year = 2009 } = movie;

Explanation

name: title renames the variable, and = 2009 provides a default when the property is undefined.

Further reading

Problem with a question

JavaScript · Junior · question 60

Test yourself

Take the JavaScript · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz