Quantcast
Channel: Geekstrick
Viewing all articles
Browse latest Browse all 10

How to use for loops to break out early in javascript?

$
0
0

for loop in modern JavaScript is rarely talked about although it’s only useful in asynchronous operation scenarios. But what breaking out early consider the following example: Matching two array const smallArray = [0, 2]; const largeArray = Array.from({ length: 1000 }, (_, i) => i); const areEqual = (a, b) => { let result = […]

The post How to use for loops to break out early in javascript? appeared first on Geekstrick.


Viewing all articles
Browse latest Browse all 10

Trending Articles