In this article, We’ll see what’s the difference between substr and substring 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.
The substring() method returns the part of the string between the start and end indexes, or to the end of the string.
Below an example
let str = "nexladder web tutorials"; console.log(str.substring(1, 3)); // Output: ex -> Excludes the last index console.log(str.substr(1, 3)); // Output: exl -> Includes the last index
That’s it!. Please share your thoughts or suggestions in the comments below.