Substring vs Substr | Javascript

The substring() method extracts the characters from a string, between two specified indices, and returns the new sub string. This method extracts the characters in a string between “from” and “to”, not including “to” itself.

string.substring(from, to)

The substr() method extracts the characters from a string, beginning at “start” and through the specified number of character, and returns the new sub string.

string.substr(start,length)

References: here and here

Hello, nice to meet you

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

1 Comments

Leave a Reply to hfrmobile Cancel reply