How to get last index of string in JavaScript

1 Answer

0 votes
const string = "javascript";

const last_index = string.length - 1;

console.log(last_index); 
 
 
 
   
     
     
/*
run:
     
9
     
*/

 



answered Jun 4, 2021 by avibootz
...