What is Substr in JavaScript?
The substr() method extracts parts of a string, beginning at the character at the specified position, and returns the specified number of characters. Tip: To extract characters from the end of the string, use a negative start number (This does not work in IE 8 and earlier).
How does substring work in JavaScript?
The substring () method extracts the characters from a string, between two specified indices, and returns the new sub string. … Substring (4, 1). If either “start” or “end” is less than 0, it is treated as if it were 0. Note: The substring () method does not change the original string.