How to get the last index of a string in Javascript?

string.length-1 is used to get the last index of a string in Javascript

Example Usage:-

var myString=”JavascriptQuestions”;
console.log(myString.length-1);

How to get the last index of a string in Javascript?
Show Buttons
Hide Buttons