Calling addClass and toggleClass without arguments

Calling addClass and toggleClass without arguments (or what is more likely with variables that has undefined or null values) will freeze up your script. Now the script will just ignore it and doesn't add anything new to the elem's classList.