Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const person = {
- name: 'John Doe',
- country: 'Canada'
- };
- // Assign default value of 25 to years if age key is undefined
- const { name: fullname, country: place, age: years = 25 } = person;
- // Here I am using ES6 template literals
- console.log(`I am ${fullname} from ${place} and I am ${years} years old.`);
- // I am John Doe from Canada and I am 25 years old.'
Add Comment
Please, Sign In to add comment