🌐
GeeksforGeeks
geeksforgeeks.org › javascript › difference-between-substr-and-substring-in-javascript
Difference between substr() and substring() in JavaScript - GeeksforGeeks
July 11, 2025 - In JavaScript Both of the functions are used to get the specified part of the string, But there is a slight difference between them. substr() and substring() are string methods used to extract parts of a string.
Discussions

What is Difference between SUBSTR(), MID(), SUBSTRING() in SQL?
in SQL? they're all identical perhaps instead of "SQL" you meant "Microsoft SQL SERVER"??? More on reddit.com
🌐 r/SQL
4
1
January 8, 2020
When I can't remember the difference between slice, splice, substr and substring
Who needs consistency anyways. Somebody should tell the people that make JS standards that just because all other languages already use "start,length" they don't necessarily had to pick "start,end" More on reddit.com
🌐 r/ProgrammerHumor
7
339
February 19, 2022
If you could only use string.slice or string.substring, which string method would you choose?
.slice() seems to have become more popular. Advantages: Accepts negative values as parameters. Same name as Array.protoype.slice() Differences between the two: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substring#Differences_between_substring_and_slice More on reddit.com
🌐 r/learnjavascript
1
3
November 24, 2019
String.{substr, substring, splice}: which to use?

The header says substr, substring and splice

but the content talks about String.prototype.slice

Nice to point out the substr vs substring differences though!

More on reddit.com
🌐 r/javascript
5
6
November 17, 2014
🌐
John Kavanagh
johnkavanagh.co.uk › home › articles › javascript string manipulation: substring() vs. substr()
JavaScript String Manipulation: substring() vs . substr()
November 23, 2022 - When in doubt, prefer substring() for its consistency with the standard and its predictable, standardised behaviour. When refactoring legacy code, don't simply swap substr() out for substring() without paying close attention to the parameters. Add a clap for this article.1,3951,395 claps so far. ... Solving the LeetCode Two Sum Problem Using JavaScript.
🌐
Edureka
edureka.co › blog › javascript-substring
JavaScript Substring() | How is it different from substr() & slice()? | Edureka
January 9, 2025 - The substring() is an inbuilt function in JavaScript which returns a part of the given string from start index to end index. The indexing starts from zero.
🌐
Mastering JS
masteringjs.io › tutorials › fundamentals › substring
Substring vs Substr vs Slice in JavaScript - Mastering JS
June 20, 2019 - The substring() function is the most common way to get a substring in JavaScript. It takes two parameters: indexStart and indexEnd. It returns the portion of the string that starts at indexStart and ends the character immediately preceding indexEnd.
🌐
SkillForge
skillforge.com › home › blog & tutorials › substr vs substring in javascript
Substr vs Substring in JavaScript | SkillForge Blog
February 18, 2019 - This would return “ill” from “Skill”. The 2 tells us where to begin which is the letter “i” and then the 5 tells us how far to go into the string, not how many characters, the ending point. With substring the end character is NOT included.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › String › substring
String.prototype.substring() - JavaScript - MDN Web Docs
The substring() method of String values returns the part of this string from the start index up to and excluding the end index, or to the end of the string if no end index is supplied.
🌐
Jim Nielsen's Blog
blog.jim-nielsen.com › 2019 › difference-between-substr-and-substring-in-javascript
The Difference Between substring and substr in JavaScript - Jim Nielsen’s Blog
January 4, 2019 - The difference is in the second argument. The second argument to substring is the index to stop at (but not include), but the second argument to substr is the maximum length to return.
Find elsewhere
🌐
DigitalOcean
digitalocean.com › community › tutorials › js-substring-vs-substr
substring vs substr in JavaScript | DigitalOcean
November 6, 2017 - substr() method is very similar, but the second argument is not for the end index, it’s for the amount of characters.
🌐
Stack Abuse
stackabuse.com › bytes › difference-between-substr-and-substring-in-javascript
Difference Between substr() and substring() in JavaScript
September 13, 2023 - The substr() method in JavaScript is used to extract parts of a string, starting from the index specified and extending for a given number of characters afterwards.
🌐
W3docs
w3docs.com › home › code snippets › javascript › what is the difference between substr and substring
What is the Difference Between Substr and Substring | W3docs
Both methods can take two parameters, but <kbd class="highlighted">substr()</kbd> uses a start index and a length, while <kbd class="highlighted">substring()</kbd> uses a start index and an end index (excluding).
🌐
Blogger
javarevisited.blogspot.com › 2013 › 08 › difference-between-substr-vs-substring-in-JavaScript-tutorial-example.html
Difference between SubStr vs SubString function in JavaScript - Tutorial Example
Main difference between substr and substring method comes from there second parameter, substr(to, length) accepts length of expected substring, while substring(to, from) accept end index, which is excluded.
🌐
MangoHost
mangohost.net › mangohost blog › javascript substring vs substr: differences explained
JavaScript Substring vs Substr: Differences Explained
August 4, 2025 - Both substring() and substr() extract portions of strings, but they interpret their parameters differently.
🌐
Itsourcecode
itsourcecode.com › home › differences between javascript substring vs. substr
Differences Between JavaScript Substring vs. Substr - Itsourcecode.com
August 9, 2023 - In this article, we will discuss the difference between “substring” and “substr” and provide practical understanding on how to utilize them effectively. Manipulating strings is an essential aspect of JavaScript programming.
🌐
Arunkumar Blog
arungudelli.com › home › tutorial › javascript › javascript substring vs substr vs slice differences with examples
JavaScript Substring Vs Substr Vs Slice Differences With Examples
November 5, 2019 - We might think why we need two different methods slice() and substring() as their behaviour is same. It is all about negative indexes. The initial JavaScript created in Netscape 2.0 has only substring() method. If the parameters are negative they treated as 0.
🌐
Ditectrev
blog.ditectrev.com › blog › software-development › web-development › frontend › javascript › slice-vs-substring-vs-substr-complete-javascript-string-methods-comparison
slice() vs substring() vs substr(): Complete JavaScript String Methods Comparison | 📝 Ditectrev Blog | #Build Your Digital Future.
January 12, 2026 - Unlike slice(), substring() has some quirky behaviors that can lead to unexpected results, making it less intuitive for many developers. substring() was one of the earliest string methods in JavaScript (since ES1) and has legacy behaviors that were kept for backward compatibility.
🌐
W3Schools
w3schools.com › jsref › jsref_substr.asp
JavaScript String substr() Method
The substr() method is removed (deprecated) in the latest JavaScript standard.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › String › substr
String.prototype.substr() - JavaScript - MDN Web Docs
1 week ago - The substr() method of String values returns a portion of this string, starting at the specified index and extending for a given number of characters afterwards.
🌐
To The New
tothenew.com › home › technology › javascript : string.slice() vs string.substring() vs string.substr()
JavaScript : String.slice() vs String.substring() vs String.substr() | TO THE NEW Blog
August 29, 2016 - Same with substring and substr also. const result = name.substring(1) // ‘ipin’ const result = name.substr(1) // ‘ipin’ ... Great! You have drawn a very good comparison of the various methods to slice up strings in JavaScript.