michael@0: String.prototype.m = function(s) { michael@0: return this.indexOf('a'); michael@0: }; michael@0: michael@0: var g = function(s) { michael@0: return (s + 'asdf').m(); michael@0: }; michael@0: michael@0: var h = function(s) { michael@0: return ('asdf' + s).m(); michael@0: }; michael@0: michael@0: var ix = g(new String('abc')); michael@0: assertEq(ix, 0); michael@0: michael@0: var ix = h(new String('abc')); michael@0: assertEq(ix, 0);