Knowledge Walls
Laya
Hyderabad, Andhra Pradesh, India
String.prototype.substring() Method in String Class of Javascript Syntax with Examples
2345 Views
Usage 
substring() function used to take specific part of string or character from the main string as like substr().

Note: 
Only difference between these two function -The substring() not include the end position character when it seperate
 the main string.
Syntax
	string.substring(startPosition,endPosition)
	
	End position is optional,If end position not determined the string taken upto the last character.
Example
var userName = "Abdulkalam";

//without end position
var char1 = userName.substring(2);
document.write("string is "+char1+" .");

//with end position
var char2 = userName.substring(1,6);
document.write("string is "+char2+".");
Output 
string is dulkalam.
string is bdulk.
Best Lessons of "Javascript Syntax with Examples"
Top lessons which are viewed more times.
  Copyright © 2014 Knowledge walls, All rights reserved
KnowledgeWalls
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details