大佬们,为什么我括号内输入2,输出的结果是I,如果是mystr.length-1出的结果是!
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>string对象 </title>
<script type="text/javascript">
var mystr="I love JavaScript!"
document.write(mystr.charAt(mystr.length-1));
</script>
</head>
<body>
</body>
</html>