string.length property with
1. So, it returns the last index of a string.
In this below example, we are getting the last value index of the following string.
const string= "what is bad"; console.log(string.length-1);