Incidents like the code snippet below underline the root cause of failure on most projects (and why I fully expect to die from a heart attack at a very young age):
if(!((yearObj.options[yearObj.selectedIndex].value / 4).toString().indexOf('.') == -1))
(Sorry about any line wrapping that may have occurred.)
That beautiful specimen was purported to compute if a selected year was a leap year or not. No, really. I could spend the rest of this day discussing the failure of the industry to police itself to maintain minimum standards, how programmers are not just generic blobs that can be pulled from one project and jammed into another, how lack of time and infrastructure perpetuate catastropic problems, etc, etc, etc … but I wont.
Another one just in (from the same person as the beauty above):
for (var i = 1; i < days + 1; i++)
Of course there is nothing inherently wrong with the statement, but what is wrong is that there is a fundamental un-understanding (rather than a misunderstanding which implies that there is some understanding to begin with) of the principles of software engineering.