hiflight sentence based on index
const s = "Old Man's War"
const indices = [[0,0],[2,4],[5,5],[11,11]]
const final = indices.map(([start,end])=> s.slice(start,end+1))
let output = ''
for(let i=0; i<s.length; i++){
if(indices[0][0] === i){
output += `<span class="bold">${final[0]}</span>`
i += indices[0][1]
indices.shift()
final.shift()
} else{
output += s[i]
}
}
document.getElementById("result").innerHTML = output;