Skip to content

Instantly share code, notes, and snippets.

@sbussard
Created October 6, 2020 05:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sbussard/cc46a4f16bbaf892d4a666ca7f105d04 to your computer and use it in GitHub Desktop.
Save sbussard/cc46a4f16bbaf892d4a666ca7f105d04 to your computer and use it in GitHub Desktop.
isHotdog
let prop = new Proxy({}, { get: (_, name) => (obj) => obj[name] });
let foods = [
{ name: 'hotdog', isHotdog: true },
{ name: 'pizza', isHotdog: false },
{ name: 'spaghetti', isHotdog: false }
];
console.log(foods.map(prop.name));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment