Skip to content

Instantly share code, notes, and snippets.

@DrummerHead
Last active August 6, 2016 01:44
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 DrummerHead/36e34d47f81c4afe6f57aa6f66892069 to your computer and use it in GitHub Desktop.
Save DrummerHead/36e34d47f81c4afe6f57aa6f66892069 to your computer and use it in GitHub Desktop.
// Use this script on your
// preferred modern browser console
const meme = (text) => {
return [...text.toUpperCase()].reduce((prev, curr, i, ary) => {
return [`${prev[0]}${ary[i]} `, `${prev[1]}\n${ary[i + 1] || ''} `];
}, ['','']).reduce((prev, curr) => prev + curr);
};
const result = meme('Aesthetics');
copy(result); // Text is copied to clipboard
console.log(result);
// A E S T H E T I C S
// E
// S
// T
// H
// E
// T
// I
// C
// S
// The two final spaces are so
// Markdown inserts a final <br>
// (Reddit uses Markdown)
@nicbou
Copy link

nicbou commented Jul 21, 2016

Here's a much shorter version

t=>[[...t.toUpperCase()].join(' '),...t.toUpperCase().substr(1)].join('\n');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment