Answers for "find last word contains string javascript"

4

get last word in string js

function test(words) {
    var n = words.split(" ");
    return n[n.length - 1];
}
Posted by: Guest on May-04-2021
0

Js last word in a string

String test =  "This is a sentence";
String lastWord = test.substring(test.lastIndexOf(" ")+1);
Posted by: Guest on February-02-2022

Code answers related to "find last word contains string javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language