Get Programming with JavaScript - Listing 3.18

Listing 3.18 - Assigning properties to variables

const book = { title : "The Hobbit", author : "J. R. R. Tolkien", published : 1937 }; // declare two variables whose names match // properties of the object. // assign the matching values to the variables const { title, author } = book; console.log(`${title} by ${author}`);