JSFiddle - React, Tailwind, and code Playground

HTML

<p>Click to remove the first character</p>
<p>Click to remove the last character</p>
<p>Click to remove the letter r character</p>

JavaScript

$("p:eq(0)").on("click", function(){
    $(this).text(function(index, text){
        return text.replace(/^.(\s+)?/, '');
    });
});

$("p:eq(1)").on("click", function(){
    $(this).text(function(index, text){
        return text.replace(/(\s+)?.$/, '');
    });
});

$("p:eq(2)").on("click", function(){
    $(this).text(function(index, text){
        return text.replace(/r/gi, '');
    });
});