Javascript String even()

Description

Javascript String even()

String.prototype.even = function() {
  var temp = [];//from   w w  w  . j  av a 2 s  .c  o m
  for (var i = 0; i < this.length; i++) {
    if (i%2 == 0) temp.push(this[i]);
  };
  return temp.join('');
};



PreviousNext

Related