DEV Community

rodman864
rodman864

Posted on

1

Loops

What is the use of a counter variable?
It is used to track the number of times a block of commands is ran.

What happens when a counter variable reaches or exceeds a specified value?
When it reaches or exceeds a specific value, the loop stops.

Which is the most common counter variable?
The most common counter variable is i.

What is a command block?
It is a set of JavaScript commands enclosed within a set of curly braces.

Which is the main difference between a while loop and a for loop?
The main difference is the for loops are used whenever you have a counter variable. The while loops are used with conditions.

Top comments (0)

SurveyJS custom survey software

JavaScript UI Libraries for Surveys and Forms

SurveyJS lets you build a JSON-based form management system that integrates with any backend, giving you full control over your data and no user limits. Includes support for custom question types, skip logic, integrated CCS editor, PDF export, real-time analytics & more.

Learn more