3-14编程练习
来源:3-14 编程练习
RoseMe
2018-12-12 11:20:16
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>string方法</title>
</head>
<body>
<script>
//获取到下面字符串中的字符“world”
var str="Program ape world you do not understand"; //39
document.write(str.slice(12,17));//初始值,结束位置+1
document.write("<br/>");
document.write(str.substr(12,5));//初始值,截取的个数
document.write("<br/>");
document.write(str.substring(12,17));//语法同slice,但是遇负数转0
</script>
</body>
</html>
1回答
经测试代码是没有问题的,继续加油!
相似问题