Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
/*!
* heading-break.js
* LICENSE: http://hail2u.mit-license.org/2018
*/
const addWordJoiner = (added, value, index) => {
if (index > 3) {
return `${value}${added}`;
}
return `${value}\u2060${added}`;
};
for (const heading of document.querySelectorAll("main > article > h1")) {
heading.textContent = heading.textContent
.split("")
.reverse()
.reduce(addWordJoiner);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.