Try to create a jQuery plugin after you’ve modified String.prototype, and you get a TypeError. Why? Is it a jQuery’s bug? It does bother me when it comes to function ordering. Now I have to always take care of creating jQuery plugins before modifying prototypes. See these fiddles:
This fiddle Throws Type Error (because jQuery plugin is created after prototype modification)
This fiddle is ok.
Just put a semicolon after this function expressin
Updated fiddle.
Semicolons are optional in
javascriptbut some times it matters so you should always use semicolon, it’s a good programming practice, check this and also this on SO.