var str = "Happy New Years"; var p = str.lastIndexOf(" "); console.log(p); // return 9 var p = str.lastIndexOf("/ /gi"); console.log(p); // return -1 var p = str.lastIndexOf("/\s/gi"); console.log(p); // return -1
lastIndexOf
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)