logo
logo

Log Name

Log Name

Create a function that takes an object as a parameter and destructures its properties in the function body with default and renamed variables to log its values to the console.

For example, given the object
const person = { firstName: 'John', lastName: 'Doe' }
, the function
logPersonName(person)
would destructure the
firstName
and
lastName
properties in the function body with default and renamed variables and log
John
and
Doe
to the console, or
Unknown
and
Doe
if
firstName
is not provided.

Console
Submit
Solution
00:00