gigafied/microjs.com — comment on commit 3d96f11eb7eb36a4910f195c7a16961e9d456615
File: lib/validator.js line 22
By gigafied:

It's a relatively unimportant difference either way in this case, but indexOf gets faster the closer is to the beginning of the string.

http://jsperf.com/regexp-test-versus-string-indexof/2

You'll see that Chrome (V8, which is the only applicable test case here anyway due to this running in node), is 150% faster with indexOf when "" occurs at the beginning of the string.

Firefox, which is irrelevant for this particular case is 300% faster.