Posted On: Oct 31, 2022
Difference between the substr() and substring() functions in JavaScript.
The substr() function has the form substr(startIndex,length). It returns the substring from startIndex and returns ‘length’ number of characters.
var s = "hello"; ( s.substr(1,4) == "ello" ) // true
The substring() function has the form substring(startIndex,endIndex). It returns the substring from startIndex up to endIndex – 1.
var s = "hello"; ( s.substring(1,4) == "ell" ) // true
Never Miss an Articles from us.
Javascript Javascript is an object-oriented computer programming language commonly used to create interactive effects wi..
What is the difference between let and var?..