Home > Article > Web Front-end > Explanation of the difference between substring and substr functions in JS_javascript skills
1. Function declaration in JS: stringObject.substring(start,stop)
start is the starting position of the original string retrieval, stop is the ending position of the retrieval, and the returned result does not include the character pointed by stop.
For example : "hamburger".substring(4,8) returns "urge"
2. substr(start,length)
For example: when the value of DETAIL_TYPE is 1111053, substr(DETAIL_TYPE,1,6) = 111105
Take six characters starting from the first digit of DETAIL_TYPE.