An anonymous function is just a function that has no name.
A closure is a function that captures the state of the surrounding environment.
An anonymous function does not necessarily need to create a closure, and a closure is not created only for anonymous functions.
anonymous function:
(function() { // anonymous function // code to run })();
closure:
function outer() { var greeting = "hello "; (function(name, greeting) { alert(greeting + name); })("John Doe", greeting); }