Many JavaScript libraries use this technique. It helps to develop a closure around the contents of the file which helps to create a private namespace and hence, avoid any name clash with different JavaScript modules and libraries.