Code: Select all
String.prototype.myFunction = function () {
alert("Hello");
}
Code: Select all
new String().myFunction(); //returns and alert message displaying "Hello"
Code: Select all
"".myFunction(); // returns an error(a "type error"). [i]TypeError: "".myFunction is not a function[/i]
1wrd: WTF?