The stringobject.substring (start,stop) substring () method is used to extract the character of a string intermediary between two specified subscripts.
STRINGOBJECT.SUBSTR (start,length) required. The starting subscript for the substring to extract. Must be numeric. If it is a negative number, the argument declares the position from the end of the string.
Stringobject.slice (start,end) Start subscript of the fragment to extract. End subscript at the end of the fragment to be extracted immediately.
-------------
It is said that SUBSTR is not recommended.
The methods of the String object Slice (), substring (), and substr () (not recommended) can return the specified part of the string.
Slice () is more flexible than substring () because it allows negative numbers to be used as arguments.
Slice () differs from substr () because it specifies a substring with a position of two characters, and substr () specifies a substring with a character position and length.
Also note that String.slice () is similar to Array.slice ().
//////////////////////////
Http://www.w3school.com.cn/jsref/jsref_slice_string.asp
/////////////////////////
Start Required. A nonnegative integer that specifies the position of the first character of the substring to be extracted in the stringobject.
Stop is optional. A nonnegative integer that is 1 more than the last character of the substring to extract in Stringobject.
If this argument is omitted, the returned substring continues until the end of the string.
Returns a new string value that contains a substring of stringobject whose contents are all characters from start to stop-1, with a length of stop minus start. The substring returned by the substring () method includes the character at start, but does not include the character at the stop.
-----------------
<script type= "Text/javascript" >
var str= "Hello world!" document.write (str.substring (3,7))
</script>
Output: lo w = = = No 7th bit-does not contain stop-the value specified in Firebug or other detection tools
----------------------
Substring substr Slice JS comparison