Nodejs String Delete delete(remove)

Here you can find the source of delete(remove)

Method Source Code

String.prototype.delete = function(remove) {
 var result= '';
 for(var i=0;i<this.length;i++) {
    for (var j=0;j<remove.length;j++) {
    if(this.charAt(i) != remove.charAt(j)) {
        result += this.charAt(i)//w w w .  j  ava  2s  .  c om
    }
    }
 }
 return result
}

console.log("Hello World".delete('o'))

Related

  1. delete()
    String.prototype.delete=function() {
      for(var e in arguments) {
        console.log(typeof arguments[e]);
        this.replace(arguments[e],'');
        console.log(this);
      return this.valueOf();
    console.log("Hello World123".delete(/h/gi, /[0-9]/g));
    ...
    
  2. delete()
    String.prototype.delete = function () {  
      var str = this.toString();
      for(let i = 0; i < arguments.length; i++) {
        switch(typeof arguments[i]) {
          case 'string':    
            str = str.replace(new RegExp(arguments[i], 'g'), "");
            break;
          case 'object':
            str = str.replace(arguments[i], "");    
    ...