JavaScript for in语句
JavaScript for in语句
Js代码1.var tom = {name: 'Tom', gender: 'Male', age: 17};
2.for (att in tom) {
3. alert('tom.' + att + ' = ' + tom);
4.}
5.
6.var protocols = ['HTTP', 'FTP', 'SMTP'];
7.for (index in protocols) {
8. alert('protocols[' + index + '] = ' + protocols);
9.}
var tom = {name: 'Tom', gender: 'Male', age: 17};
for (att in tom) {
alert('tom.' + att + ' = ' + tom);
}
var protocols = ['HTTP', 'FTP', 'SMTP'];
for (index in protocols) {
alert('protocols[' + index + '] = ' + protocols);
}
谢谢分享希望于楼主多多交流
页:
[1]