Defensive JavaScript? Yes, Please!

added by JavaScript Kicks
3/24/2015 2:42:35 AM


Every developer knows the feeling of hours wasted hunting down some obscure bug. Programming would be so much faster and more enjoyable if we could avoid these bugs before they happen. Since no magical solution is on the horizon, we can at least write our code as defensively as possible. But what does defensive code really mean? According to Wikipedia: Defensive programming is a form of defensive design intended to ensure the continuing function of a piece of software under unforeseen circumstances. (So yeah, they used the word "defensive" in the definition.)