Skip to content

Instantly share code, notes, and snippets.

@chrishutchinson
Created October 14, 2018 13:34
Show Gist options
  • Save chrishutchinson/f3486e9637bf6cb59d02c3afadd699ca to your computer and use it in GitHub Desktop.
Save chrishutchinson/f3486e9637bf6cb59d02c3afadd699ca to your computer and use it in GitHub Desktop.
Hacking with JavaScript and Shortcuts (#3)
const emojis = {
american: "🇺🇸",
science: "🔬",
horror: "🙀",
second: "🥈",
written: "✏️",
television: "📺"
};
const replaceWordsWithEmoji = text =>
Object.keys(emojis).reduce(
(acc, word) => acc.replace(new RegExp(word, "g"), emojis[word]),
text
);
document.body.innerHTML = replaceWordsWithEmoji(document.body.innerHTML);
completion();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment