title: Set String via String.prototype function without return
body: <p>I have the following function to add <code>splice</code> to a string:</p>
  
  <pre><code>String.prototype.splice = function(index, howManyToDelete, stringToInsert) {
      var characterArray = this.split('');
      Array.prototype.splice.apply(characterArray, arguments);
      return characterArray.join('');
  }
  </code></pre>
  
  <p>However it does quite work exactly like <code>Array.prototype.splice</code>, which I need it to. The array splice returns the values which were removed. So I just need to know how to set a new value to a <code>String</code> without having to return the value.</p>
  
  <pre><code>String.prototype.splice = function(index, howManyToDelete, stringToInsert) {
      var characterArray = this.split(''),
          retVal = Array.prototype.splice.apply(characterArray, arguments);
      newstringvalue = characterArray.join('');
      return retVal;
  }
  </code></pre>
  
  <p>Edit:<br />Apparently you can't do that, this will have to suffice:</p>
  
  <pre><code>String.prototype.splice = function(index, howManyToDelete, stringToInsert) {
      var characterArray = this.split(''),
          rem = Array.prototype.splice.apply(characterArray, arguments);
      return {'s' : characterArray.join(''), 'x' : rem.join('')};
  }
  </code></pre>