Let's say I'm given
const s = "Old Man's War"
//Each indices represent the beginning and end index of the string
const indices = [
[ 0, 0 ],
[ 5, 5],
[ 11, 11]
]
The indices represent beginning and end of what I want to highlight. So I want to return something like
<span class="bold">O</span>ld M
<span class="bold">a</span>n's W
<span class="bold">a</span>r
How can I do this? Can't seem to come up with a decent algorithm.