Skip to content

Instantly share code, notes, and snippets.

@jreyes33
Created March 24, 2015 04:36
Show Gist options
  • Select an option

  • Save jreyes33/c26a8b6781aa8fa9e3b5 to your computer and use it in GitHub Desktop.

Select an option

Save jreyes33/c26a8b6781aa8fa9e3b5 to your computer and use it in GitHub Desktop.
Better emoji support in ES6
let isAnimal = (emojo) =>
'πŸ€'.codePointAt(0) <= emojo.codePointAt(0) &&
emojo.codePointAt(0) <= '🐼'.codePointAt(0);
let emoji = ['🐢', 'πŸ‘»', '🐸', '🐻', 'πŸ’©', '🐳'];
let animals = [for (e of emoji) if (isAnimal(e)) e];
console.log(animals);
// => ["🐢","🐸","🐻","🐳"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment