This bit of JavaScript confused me. This is tested on Gecko’s JavaScript engine only.
String.prototype.i = function() { return this; }
String.prototype.i2 = function() { return this+”"; }
typeof(“a string”.i()) == “string” // => false
typeof(“a string”.i2() == “string” // => true
Monthly Archives: April 2007
JavaScript’s String Identity Method is Not Trivial
April 17, 2007 – 3:35 am