JavaScript: Understanding the Weird Parts