1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
String.prototype.m = function(s) { return this.indexOf('a'); }; var g = function(s) { return (s + 'asdf').m(); }; var h = function(s) { return ('asdf' + s).m(); }; var ix = g(new String('abc')); assertEq(ix, 0); var ix = h(new String('abc')); assertEq(ix, 0);