循环出来的结果是“爱” “你”,怎么才能单独的截图“爱”字呢
如题,使用for循环,怎么才能单独的截取“爱”字呢
代码如下:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Array对象 </title>
<script type="text/javascript">
var myarr1= ["我","爱","你"];
for(var i=0;i<myarr1.length;i++)
{
if(myarr1[i]=="爱")
{
document.write(myarr1.slice(i));
break;
}
}
</script>
</head>
<body>
</body>
</html>