The syntax of the SubString function is:
- 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 continues to the last.
- If the second index value is higher than the first index, it will swap two arguments.
- And, If you are using the Negative numbers as an argument, it will consider zero.
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 the second as 2. This function will swap two arguments which means that it is equal to Str1.substring(2, 13).