Javascript String forEach(block, separator)

Description

Javascript String forEach(block, separator)


// String additions

String.prototype.forEach = function(block, separator) {
    system.print("WARNING: String.prototype.forEach deprecated");
    block(String(this)); // RHINO bug: it thinks "this" is a Java string (?!)
}

Javascript String forEach(block, separator)

// String additions

String.prototype.forEach = function(block, separator) {
    block(String(this)); // RHINO bug: it thinks "this" is a Java string (?!)
    //from ww  w .ja va2  s .c  o  m
    //if (!separator)
    //    separator = /\n+/;
    //
    //this.split(separator).forEach(block);
}



PreviousNext

Related