Comment by viraptor

5 years ago

It's not even sloppy. When people write code with dependency X, they don't check if X is available before every call. The website works as designed. The user decided to change the environment behaviour in an unexpected way.

It's not even sloppy

It’s the definition of sloppy. Rule One of Javascript is that you check every 3rd party dependency before every call.

  window.ga && ga(“user likes socks”);

For exactly this reason: because often all you get is what you sent down the wire yourself. You still need to work with that.