Javascript Array odds()

Description

Javascript Array odds()

Array.prototype.odds = function () {
  var a = [], o = this;
  for (var i = 0; i < o.length; i++) {
    if (i%2==0) a.push(o[i]);
  }/*  w ww . j  a va  2 s.c  om*/
  return a;
};



PreviousNext

Related