js back last word . ! ? in string code example
Example 1: get last word in string js
function test(words) {
var n = words.split(" ");
return n[n.length - 1];
}
Example 2: how to get last string in javascript
'abc'.slice(-2);
function test(words) {
var n = words.split(" ");
return n[n.length - 1];
}
'abc'.slice(-2);