首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

JavaScript for in话语

2012-11-09 
JavaScript for in语句?var tom {name: Tom, gender: Male, age: 17}for (att in tom) {alert(tom

JavaScript for in语句

?

var tom = {name: 'Tom', gender: 'Male', age: 17};for (att in tom) {alert('tom.' + att + ' = ' + tom[att]);}var protocols = ['HTTP', 'FTP', 'SMTP'];for (index in protocols) {alert('protocols[' + index + '] = ' + protocols[index]);}var comment = 'It is beautiful.';var str = '';for (s in comment) {str = str + ', ' + s;}str = str.slice(2);alert(str);

热点排行