Typography: a small widow prevention function
Just a small function to insert a non-breaking space into a string. And this is what it prevents:
function widont(heading) {
let i = heading.lastIndexOf(' ')
if (i < 0) { return heading }
let beginning = heading.substr(0, i)
let end = heading.substr(i + 1, heading.length - i + 1)
return beginning + '\u00a0' + end
}