The Property Hunter
Medium+20 XP
Mission Briefing
The ancient grimoire holds many secrets, but we only need to extract its title to catalog it! Don't carry the whole book object around, just yank out what you need.
The Concept: Destructuring
Object Destructuring lets you extract properties right into variables using curly braces! The variable name must perfectly match the object's property name.
Example: const { name } = { name: "JS", level: 1 };
The Objective
Your function receives a book object.
- Extract the exact
titleproperty from thebookobject using object destructuring. - Return that extracted
titlestring alone.
01EXAMPLE 1
Input
book = { title: "JS30", author: "Dev" }Output
"JS30"Constraints
- Use object destructuring { title } = book.
CoreES6+
JavaScriptSystem handles I/O — write your function only
Loading...
3 Hidden
Input Arguments
book{"title":"JS30","author":"Dev"}
Expected Output
JS30
Click RUN to test your solution