首页 | 编程语言 | 网站建设 | 游戏天堂 | 冲浪宝典 | 网络安全 | 操作系统 | 软件时空 | 硬件指南 | 病毒相关 | IT 认证
软讯网络 > 网站建设 > ASP.NET > MsAjax Lib-> Array.forEach 函数
【标  题】:MsAjax Lib-> Array.forEach 函数
【关键字】:MsAjax,Lib-,Array.forEach
【来  源】:http://blog.csdn.net/chsword/archive/2007/02/25/1514114.aspx

MsAjax Lib-> Array.forEach 函数

Array.forEach 函数

对指定数组的每个元素执行指定操作。 静态函数,使用无需实例化。

语法

Array.forEach(array, method, context);

参数

参数

说明

array

要进行操作的Array 对象.

method

调用来操作每个数据元素的方法.

instance

The context for calling method.

备注

使用 forEach函数 对指定数组的每个元素执行指定操作。

注意

除Firefox外的其它浏览器,使用forEach函数时将忽略为undefined的元素. 任何情况下函数将忽略 unassigned 元素.

以下示例展示如何使用forEach 函数.

JavaScript

var a = ['a', 'b', 'c', 'd'];
a[5] = 'e';
var result = '';

function appendToString(arrayElement, index, array) {
// "this" is the context parameter, i.e. '|'.
result += arrayElement + this + index + ',';
}
Array.forEach(a, appendToString, '|');
// 返回结果: a|0,b|1,c|2,d|3,e|5,
document.write(result,"</p>");

 
MsAjax Lib-> Array.indexOf 函数:【上一篇】
DO_LOOP_UNTIL在ASP中的应用:【下一篇】
【相关文章】
  • MsAjax Lib-> Array.indexOf 函数
  • MsAjax Lib-> Array.insert 函数
  • MsAjax Lib-> Array.remove 函数
  • MsAjax Lib-> Array.removeAt 函数
  • MsAjax Lib-> Boolean 类型扩展
  • MsAjax Lib-> Boolean.parse 函数
  • MsAjax Lib-> Date.format 函数
  • MsAjax Lib-> Date.localeFormat 函数
  • MsAjax Lib-> Date.parseLocale 函数
  • MsAjax Lib-> Date.parseInvariant 函数
  • 【随机文章】
  • OSWorkFlow入门指南
  • DELPHI基础教程--第三章 字符串列表及应用(二)
  • 关于硬盘序列号的探讨!
  • c语言学习零碎整理(9):传值调用,并不简单(特别是有指针的时候)
  • 汇编实现16位有符号数的输入~~~~~~
  • Maya 4.0 粒子系统-力场(1)
  • 使用Mono进行.NET开源编程 [转]
  • Nagios安装配置
  • DoSTOR新手上路:存储区域网络基础知识普及问答
  • cdma2000-1x的短消息业务与控制信道
  • 【相关评论】
    没有相关评论
    【发表评论】
    姓名:
    邮件:
    随机码*
    评论*
          
    |  首 页  |  版权声明  |  联系我们   |  网站地图  |
    CopyRight © 2004-2007 软讯网络 All Rigths Reserved.