FrontendDeveloper.in

JavaScript Track Detail

What are the pros and cons of for loops

The for-loop is a commonly used iteration syntax in javascript. It has both pros and cons

Pros

  1. Works on every environment
  2. You can use break and continue flow control statements

Cons

  1. Too verbose
  2. Imperative
  3. You might face off-by-one errors.