亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

問下這段代碼中的==0 是什么意思。

問下這段代碼中的==0 是什么意思。

甫里 2016-04-06 19:54:25
<!DOCTYPE html><html><head>? ? <title>Prototype Pattern Example</title>? ? <script type="text/javascript">? ? ? ? ? ? ? ? ? ??? ? ? ? ? ? ? ? ? ??? ? ? ? alert(typeof Array.prototype.sort); ? ? ? ? //"function"? ? ? ? alert(typeof String.prototype.substring); ? //"function"? ? ? ? String.prototype.startsWith = function (text) {? ? ? ? ? ? return this.indexOf(text) == 0;? ? ? ? };? ? ? ??? ? ? ? var msg = "Hello world!";? ? ? ? alert(msg.startsWith("Hello")); ? //true? ? ? ??? ? </script></head><body></body></html>
查看完整描述

3 回答

?
qq_T_T

TA貢獻1條經驗 獲得超1個贊

等于0說明第一個位置就出現了

查看完整回答
1 反對 回復 2016-04-07
?
turboburst

TA貢獻26條經驗 獲得超15個贊

計算機語言中, A==B 的意思都是判斷A和B是否相等,如果相等那就返回true,不相等返回false。 你這個, return this.indexOf(text) == 0; 意思就是返回text的下標是否為0

查看完整回答
反對 回復 2016-04-07
  • 3 回答
  • 0 關注
  • 2265 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號