Logical thinking is the process of analysing, assessing, reasoning, and rationally approaching a situation - it is also referred to as an approach to problem solving.
Many people prefer to begin developing a function as a proof-of-concept, then slowly add tests alongside implementation. This loses the ability to compel you to confront your API ahead of time.
As developers, we understand the importance of avoiding unexpected exceptions. Consider a variable that is intended to be an array and you want to know its length.