在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 教程/ HTML/ 枚舉
注釋
對象
創(chuàng)建
基本運算符
數(shù)據(jù)類型
函數(shù)
For 循環(huán)
Do...While 循環(huán)
長度
While 循環(huán)
比較運算符
索引
變量
高級運算符
枚舉
條件邏輯
If
原型
可變性
數(shù)字
創(chuàng)建
編程基礎
屬性
銷毀
創(chuàng)建
等式
長度
函數(shù)聲明
字符串
條件連接
循環(huán)
連接
引用
Else
數(shù)組
高階函數(shù)
全局化

枚舉

for in 語句可以遍歷對象中所有的屬性。枚舉包括函數(shù)和原型屬性。

var fruit = {
    apple: 2,
    orange:5,
    pear:1
},
sentence = 'I have ',
quantity;
for (kind in fruit){
    quantity = fruit[kind];
    sentence += quantity+' '+kind+
                (quantity===1?'':'s')+
                ', ';
}
 // The following line removes the trailing coma.
sentence = sentence.substr(0,sentence.length-2)+'.';
 // I have 2 apples, 5 oranges, 1 pear.
上一篇:編程基礎下一篇:Do...While 循環(huán)