Skip directly to content

Only you can prevent anonymous functions!

on September 8, 2011 - 5:49pm

Most of the JavaScript you see on the web is full of anonymous functions. I don't think most of them are necessary. Allow me to demonstrate.

Imagine a PHP developer—let's call her Sunny—who doesn't really write JavaScript, but needs to toggle some text on a page. Sunny goes searching for examples on Google, and finds this jQuery snippet: