Challenge: Extract Data with Object Destructuring
Task
Create a script demonstrating object destructuring by extracting properties from the provided movie
object and logging them. Specifically, construct a logging message that includes the movie's name, producer, budget, and duration time.
123456789101112131415const movie = { name: "Going in Style", producer: "Donald De Line", duration: 96, budget: "$25 million", }; // Destructure properties from the `movie` object const { ___, ___, ___, ___ } = movie; // Use the extracted properties console.log(`Name: ${___}`); // Movie name console.log(`Producer: ${___}`); // Movie producer console.log(`Duration: ${___} minutes`); // Movie duration time console.log(`Budget: ${___}`); // Movie budget
Expected output:
Name: Going in Style
Producer: Donald De Line
Duration: 96 minutes
Budget: $25 million
- Use object destructuring to extract the
name
,producer
,duration
, andbudget
properties from themovie
object. - Construct a sentence using the extracted properties to describe the movie.
123456789101112131415const movie = { name: "Going in Style", producer: "Donald De Line", duration: 96, budget: "$25 million", }; // Destructure properties from the `movie` object const { name, producer, duration, budget } = movie; // Use the extracted properties console.log(`Name: ${name}`); console.log(`Producer: ${producer}`); console.log(`Duration: ${duration} minutes`); console.log(`Budget: ${budget}`);
¡Gracias por tus comentarios!
Pregunte a AI
Pregunte a AI
Pregunte lo que quiera o pruebe una de las preguntas sugeridas para comenzar nuestra charla
Pregunte me preguntas sobre este tema
Resumir este capítulo
Mostrar ejemplos del mundo real
Awesome!
Completion rate improved to 2.27
Challenge: Extract Data with Object Destructuring
Desliza para mostrar el menú
Task
Create a script demonstrating object destructuring by extracting properties from the provided movie
object and logging them. Specifically, construct a logging message that includes the movie's name, producer, budget, and duration time.
123456789101112131415const movie = { name: "Going in Style", producer: "Donald De Line", duration: 96, budget: "$25 million", }; // Destructure properties from the `movie` object const { ___, ___, ___, ___ } = movie; // Use the extracted properties console.log(`Name: ${___}`); // Movie name console.log(`Producer: ${___}`); // Movie producer console.log(`Duration: ${___} minutes`); // Movie duration time console.log(`Budget: ${___}`); // Movie budget
Expected output:
Name: Going in Style
Producer: Donald De Line
Duration: 96 minutes
Budget: $25 million
- Use object destructuring to extract the
name
,producer
,duration
, andbudget
properties from themovie
object. - Construct a sentence using the extracted properties to describe the movie.
123456789101112131415const movie = { name: "Going in Style", producer: "Donald De Line", duration: 96, budget: "$25 million", }; // Destructure properties from the `movie` object const { name, producer, duration, budget } = movie; // Use the extracted properties console.log(`Name: ${name}`); console.log(`Producer: ${producer}`); console.log(`Duration: ${duration} minutes`); console.log(`Budget: ${budget}`);
¡Gracias por tus comentarios!