Nodejs String Delete delete()

Here you can find the source of delete()

Method Source Code

String.prototype.delete=function() {
  for(var e in arguments) {
    console.log(typeof arguments[e]);
    this.replace(arguments[e],'');
    console.log(this);//  ww w.  ja va  2  s .c o m
  }
  return this.valueOf();
}
console.log("Hello World123".delete(/h/gi, /[0-9]/g));

Related

  1. 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], "");    
    ...
    
  2. delete(remove)
    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)
     return result
    console.log("Hello World".delete('o'))