Write Your JavaScript Code Here

// lastIndexOf(str,index)-It starts searching the element from the provided index value in the inverse order and then returns the index position of specified char/string value. // String.indexOf("str",index); let srt = "We've suffered losses war, but we've not lost the war." console.log(srt.lastIndexOf("war",49));//with the last index console.log(srt.lastIndexOf("war"));//without last index

Output: