Skip to content

Instantly share code, notes, and snippets.

@katepapineni
Last active July 29, 2020 17:00
Show Gist options
  • Save katepapineni/85539996bc94e8bf94a5fb74c9cc29c2 to your computer and use it in GitHub Desktop.
Save katepapineni/85539996bc94e8bf94a5fb74c9cc29c2 to your computer and use it in GitHub Desktop.
const hero1 = { name: 'Wonder Woman', age: 0, address: null, };
const hero2 = { name: 'Thor', age: 1500, address: '', };
const getInfo = ({ name, age, address }) => (
address
|| age
|| name
|| 'hero'
);
console.log(getInfo(hero1));
console.log(getInfo(hero2));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment