How to find the index of the last occurrence of a character in a string with Node.js

1 Answer

0 votes
const str = 'javascript php typescript node.js';

const index = str.lastIndexOf('s');

console.log(index);




/*
run:
 
32
  
*/

 



answered Jun 7, 2022 by avibootz
...