一、说明
substring方法用来剪切一段字符串中的部分字符;最核心的东西是四个字【留头去尾】:
即substring(a,b);下标从a到b,但是注意,包含a下标所对应的字符,但是不包含b下标所对应的字符;就像人,有头无尾;
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
</head>
<body>
<script>
var str="0123456789";
document.write(str.substring(0)+"<br>");//包含下标第0位
document.write(str.substring(3,7));//从下标第3位(包含)到下标第7位之间的,含头不含尾;
</script>
</body>
</html>
二、
核心:有头无尾;