There is one more type of dead code which is sometimes automatically detected by today’s IDEs those are like condition based. A code fragment runs only when a certain condition is met. This gets created based on the developer's initial thoughts in the first-time. Latter the code gets modified by the same developer after few weeks/months or by some other developers.
This happens because of the same reason as I mentioned in earlier post that they fear to remove and refactor the code base. The moment it starts working they just close it and say it’s done!
var customerIsPreferred = true;