Skip to content

Latest commit

 

History

History
16 lines (10 loc) · 748 Bytes

how_does_synchronous_iteration_works.md

File metadata and controls

16 lines (10 loc) · 748 Bytes

How does synchronous iteration work?

Synchronous iteration means that each iteration of the loop or iterator occurs one after the other. The code execution waits for the current iteration to complete before moving on to the next one. This is the default behavior in most loops like for, while, and forEach.

Example:

const arr = [1, 2, 3];
arr.forEach(item => console.log(item)); // Output: 1, 2, 3

Tags: basic, JavaScript, iteration

URL: https://www.tiktok.com/@jsmentoring/photo/7460552114478140705