Skip to content

Instantly share code, notes, and snippets.

@jreyes33
Created March 24, 2015 04:36
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jreyes33/c26a8b6781aa8fa9e3b5 to your computer and use it in GitHub Desktop.
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