JSFiddle - React, Tailwind, and code Playground
HTML
<h2>This</h2>
<h2>This is</h2>
JavaScript
$("h2").html(function(){
var text= $(this).text().split(" ");
var last = text.pop();
return text.join(" ")+ (text.length > 0 ? " <span>"+ last + "</span>" : last);
});