第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定

為什么數(shù)組長度結(jié)果跑前面去了

<!DOCTYPE?html?PUBLIC?"-//W3C//DTD?XHTML?1.0?Transitional//EN"?"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html?xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta?http-equiv="Content-Type"?content="text/html;?charset=utf-8"?/>
<title>數(shù)組長度</title>
<script?language="javascript">
?var?acv=new?Array(65,90,88,98);
?document.write("數(shù)組的長度是:"+?document.write(acv.length));
</script>
</head>
<body>
</body>
</html>

結(jié)果為啥是?4數(shù)組的長度是:undefined 而不是?數(shù)組的長度是: ?4 ?undefined


正在回答

6 回答

第9行 document.write("數(shù)組的長度是:"+?document.write(acv.length));

改為:

document.write("數(shù)組的長度是:"+acv.length);

又或者:

document.write("數(shù)組的長度是:");

document.write(acv.length); 你這用法有問題....沒見過document.write里面嵌套document.write

1 回復 有任何疑惑可以回復我~
#1

6666666666666到不行 提問者

非常感謝!
2016-07-19 回復 有任何疑惑可以回復我~

我是這樣理解的,逆向來看,程序會先執(zhí)行document.write(mynum.length)//輸出4。再執(zhí)行document.write()//輸出undefined。再執(zhí)行document.write("數(shù)組的長度是:"+undefined);至于為什么變成document.write().就不知道了??梢杂眠@個document.write(document.write(4+"<br/>"));更加清楚。

0 回復 有任何疑惑可以回復我~

重復的document.write

1 回復 有任何疑惑可以回復我~

先執(zhí)行的括號里的?document.write,所以先輸出4,把后面那個document.write去掉改成document.write("數(shù)組的長度是:"+acv.length);

1 回復 有任何疑惑可以回復我~

先執(zhí)行的括號里的?document.write所以先輸出4,改成document.write("數(shù)組的長度是:"+ (acv.length)就行了;

1 回復 有任何疑惑可以回復我~

在document.write("數(shù)組的長度是:"+?document.write(acv.length));把后面那個document.write去掉改成document.write("數(shù)組的長度是:"+acv.length);試試

3 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

為什么數(shù)組長度結(jié)果跑前面去了

我要回答 關(guān)注問題
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號