Object.extend = function (destination, source) {
 /// <summary>
    /// 扩展对象方法
    /// </summary>
    for (var property in source) {
        destination[property] = source[property];
    }
    return destination;
}Object.extend(Array.prototype, {
 each: function (iterator) {
  /// <summary>
  /// 遍历数组执行方法
  /// </summary>
  for (var i = 0, length = this.length; i < length; i++)
      iterator(this[i]);
 },
 clear: function () {
  /// <summary>
  /// 清空数组
  /// </summary>
  this.length = 0;
  return this;
 },
 indexOf: function (object) {
  /// <summary>
  /// 获取某项在数组中的位置
  /// </summary>
  for (var i = 0, length = this.length; i < length; i++)
      if (this[i] == object) return i;
  return -1;
 },
 remove: function (dx) {
  /// <summary>
  /// 移除指定索引出的对象
  /// </summary>
  if (isNaN(dx) || dx < 0 || dx > this.length) { return false; }
  for (var i = 0, n = 0; i < this.length; i++) {
      if (this[i] != this[dx]) {
          this[n++] = this[i]
      }
  }
  this.length -= 1
 },
 insertAt: function(index,obj){ 
  /// <summary>
  /// 在index处插入元素
  /// </summary>   
  this.splice(index,0,obj);    
 },
 removeAt: function(index){
  /// <summary>
  /// 移除index处元素
  /// </summary>    
  this.splice(index,1);    
 }
})