Code: Select all
Object.prototype.foo = function(){
alert(this);
}
"Hello".foo(); // would alert "Hello"
(23).foo(); // would alert 23
(document.body).foo(); // would alert [object HTMLBodyElement]
(function(){}).foo(); //would alert function(){}
I feel like the $ is so cryptic, so to speak. Without the $ it would feel more like javascript instead of a very, very punctual language.
What would this new idea be lacking, in feature, ability, etc?
Thanks for reading. Cheers.