JSFiddle - React, Tailwind, and code Playground

by Michel Piallier

HTML

<script src="https://getfirebug.com/firebug-lite-debug.js"></script>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit</p>

JavaScript

var selection=$("p");
var texte = selection.text();
var deb = texte.substring(0,texte.lastIndexOf(" "));
selection.html(deb);
//var deb=texte.replace(/[\s-]+$/, '').split(/[\s-]/).pop();
var fin=texte.substring(texte.lastIndexOf(" ")+1, texte.length);
console.log(fin);