Skip to content

Commit 2e1b05c

Browse files
Update lastIndexOf.md
1 parent 8e90144 commit 2e1b05c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

content/javascript/concepts/strings/terms/lastIndexOf/lastIndexOf.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ string.lastIndexOf(searchValue, fromIndex)
2626
- `searchValue`: The substring to search for.
2727
- `fromIndex` (optional): The position to start searching backward from. Defaults to the string’s length.
2828

29+
**Return value:**
30+
31+
Returns an integer representing the index of the last occurrence of the specified substring within the string. If the substring isn’t found, it returns `-1`.
32+
2933
## Example 1: Finding the Last Mention of a Name
3034

3135
In this example, a chat message contains multiple mentions of a person’s name, and the method finds the last one:

0 commit comments

Comments
 (0)