JSFiddle - React, Tailwind, and code Playground
by pratik24
JavaScript
var str = "a b c d e f";
var lastIndex = str.lastIndexOf(" ");
console.log(str.slice(0, lastIndex);
console.log(str.lastIndexOf(" "));
by pratik24
var str = "a b c d e f";
var lastIndex = str.lastIndexOf(" ");
console.log(str.slice(0, lastIndex);
console.log(str.lastIndexOf(" "));