- String_Object: Valid string from which you want to extract.
- Start: Index position from where you want to extract.
- End: Please specify the index position of the Endpoint. If you ignore it, the Js substring function starts from the first index position and continue to the last.
- If the second index value higher than the first index, it will swap two arguments.
- And, If you are using the Negative numbers as an argument, it will consider it as zero.
substring Function Example
Next, We ignored the second argument, which means it will start at index position 2 and ends at last.
Next, We specified the first index as 13 and second as 2. This function will swap two arguments which means the it is equal to Str1.substring(2, 13).