This is something trivial, which I've forgotten. There are possibly duplicates - I searched a little, found similar, but couldn't find as concise.
String.prototype.test = function(){this.bar = this.length + 2;}
var str = "foo";
str.test();
console.log(str); // foo
console.log(str.bar); // undefined
Pretty sure it has to do with this
being trapped in the closure.