Doubt in lastIndexOf

not got it completely

if i write 4 in it like lastIndexOf(‘ab’, 4)
then will leave 0 to 4 characters from last?

and also does it start searching from the last?

No it will read from starting only not from the end.
Also the 2nd argument is the position till where u want to check the presence of that string i.e

“I am Samarth vohra”.lastIndexOf(‘sam’ , 8)

Here it will check the last tym sam was being encountered to 8 positions where 8 is also included and returns the index from starting itself

Hope this clears your query
Happy learning :blush:

okay got it sir thanks a lot