Skip to content

Instantly share code, notes, and snippets.

@jreyes33
Created Mar 24, 2015
Embed
What would you like to do?
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