Skip to content

Instantly share code, notes, and snippets.

@tetra-fox
Last active June 26, 2020 06:09
Show Gist options
  • Save tetra-fox/fb3b051677e79c6f4e446f661ebf0a17 to your computer and use it in GitHub Desktop.
Save tetra-fox/fb3b051677e79c6f4e446f661ebf0a17 to your computer and use it in GitHub Desktop.
var rainbow = ["&c", "&6", "&e", "&a", "&b", "&d"];
var rainbowIndex = -1;
var text = "text here".split("");
text.map((obj, index) => {
if (obj !== " ") rainbowIndex++;
if (index > rainbow.length - 1 && index % 6 === 0) rainbowIndex = 0;
return rainbow[rainbowIndex] + obj;
}).join("");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment