javascript 简单数组函数,用于从数组中删除指定索引处的元素。

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了javascript 简单数组函数,用于从数组中删除指定索引处的元素。相关的知识,希望对你有一定的参考价值。

/**
 * @param {number} index  The index at which the element should be removed
 * @returns The original array without the element at specified index
 */

Array.prototype.remove = function(index) {
  return this.splice(index, 1);
};

以上是关于javascript 简单数组函数,用于从数组中删除指定索引处的元素。的主要内容,如果未能解决你的问题,请参考以下文章