You have an infinite loop, because if numbers[i] > 70 it's not increasing i, so the next loop it's checking that same condition again without an incremented i value. There are multiple ways to fix this, but one option is to output the value when numbers[i] <= 70, and always increment i.

var numbers = [12, 34, 23, 98, 08, 78, 73, 48];
var i = 0;

while (i < numbers.length){
    if (numbers[i] <= 70){
        console.log(numbers[i]);
    }
    
    i++;
}

Another option would be a different loop:

var numbers = [12, 34, 23, 98, 08, 78, 73, 48];
var i = 0;

for(i = 0; i < numbers.length; i++) {
    if (numbers[i] > 70){
       continue;
    }
    
    console.log(numbers[i]);
}

Or a simpler way:

var numbers = [12, 34, 23, 98, 08, 78, 73, 48];
var i = 0;

for(i = 0; i < numbers.length; i++) {
    if (numbers[i] <= 70){
        console.log(numbers[i]);
    }
}

Answer from WOUNDEDStevenJones on Stack Overflow
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Statements › continue
continue - JavaScript - MDN Web Docs - Mozilla
let i = 0; let j = 8; checkIAndJ: ... j: 5 // end checkJ i = 1 j = 4 i: 1 i = 2 j = 4 i: 2 i = 3 j = 4 i: 3 i = 4 j = 4 · continue cannot be used within loops across function boundaries....
Discussions

Using continue in a do-while loop - javascript
MDN states: When you use continue without a label, it terminates the current iteration of the innermost enclosing while, do-while or for statement and continues execution of the loop with the next More on stackoverflow.com
🌐 stackoverflow.com
How do I end a For or While loop without using break?
A for loop ends when it exhausts its iterable, and a while loop terminates when its condition is no longer met. If you were going to write while True: if some_variable == "some value": break #do stuff then instead you could write: while some_variable != "some value": #do stuff More on reddit.com
🌐 r/learnpython
4
4
March 19, 2022
Loop control: are continue, do..while, and labels needed?
The continue is nice for filtering (similar to early return in functions). While do..while is quite rare it is nicer when used and it's easy to implement so why not. Labels is a more interesting one. An alternative is to have an optional constant parameter that allows to specify how many loops it should break (or continue) like PHP does . This avoids the need for having to use labels. I had also another idea where one could use break break; to break two loops. It avoids the weirdness of having break; for a single loop and break 2; for breaking from two loops. Similarly for continue you could use break continue;. However my language is heavy on metaprogramming and I feel like having the ability to break multiple loops would complicate the various adjustments of the code. So I haven't implemented it for now. So far the boolean flag or similar workarounds are probably more readable and it's quite trivial for an optimizing compiler to convert it to an actual multi-level break/continue. More on reddit.com
🌐 r/ProgrammingLanguages
63
24
July 5, 2024
If `continue` is used to skip the current iteration of a loop, then why not call it `skip`?
The thing you are "continuing" isn't the current iteration of the loop; it's the sequence of iterations. Using skip would be confusing because you aren't actually skipping the current iteration, nor are you skipping the entire sequence. You could think "you're skipping everything after this point in the current iteration," but that's not always true, depending on the language. For example, consider the following Python code: for i in range(2): try: continue finally: print(i) What does this print? If the "continue" keyword here was "skip", it would be even more confusing. More on reddit.com
🌐 r/ProgrammingLanguages
48
49
February 12, 2024
People also ask

Why does continue cause an infinite loop in my while loop?
This usually happens when the counter increment is placed after the continue statement. In a while loop, jumps back to the condition check and skips everything below it, including the increment. Move the increment before the to fix this. In a for loop, this is not an issue because the update expression runs automatically.
🌐
savvy.co.il
savvy.co.il › blog › javascript complete guide › javascript continue statement: a complete guide
JavaScript continue Statement: A Complete Guide | Savvy
Can I use continue inside a forEach callback?
No. Using continue inside a forEach() callback throws a syntax error because can only be used inside a loop construct. To achieve the same skip behavior, use return inside the callback instead - it exits the current callback and moves to the next element.
🌐
savvy.co.il
savvy.co.il › blog › javascript complete guide › javascript continue statement: a complete guide
JavaScript continue Statement: A Complete Guide | Savvy
Does continue work in for...of and for...in loops?
Yes. The continue statement works in all standard loop constructs: for, whiledo...whilefor...of, and for...in. The only iteration method where it does not work is forEach(), which uses a callback function rather than a loop construct.
🌐
savvy.co.il
savvy.co.il › blog › javascript complete guide › javascript continue statement: a complete guide
JavaScript continue Statement: A Complete Guide | Savvy
🌐
Mozilla
developer.mozilla.org › en-US › docs › Web › JavaScript › Guide › Loops_and_iteration
Loops and iteration - JavaScript - MDN Web Docs - Mozilla
When you use continue without a label, it terminates the current iteration of the innermost enclosing while, do-while, or for statement and continues execution of the loop with the next iteration. In contrast to the break statement, continue does not terminate the execution of the loop entirely.
🌐
Programiz
programiz.com › javascript › continue-statement
JavaScript continue Statement
In the above example, we used a while loop to print odd numbers from 1 to 10. Notice the line, ... The value of num is incremented for the next iteration. The continue statement then skips the current iteration.
🌐
W3Schools
w3schools.com › Jsref › jsref_continue.asp
JavaScript continue Statement
cssText getPropertyPriority() ... · More examples below. The continue statement breaks one iteration (in the loop) if a specified condition occurs, and continues with the next iteration in the loop....
🌐
JavaScript.info
javascript.info › tutorial › the javascript language › javascript fundamentals
Loops: while and for
break/continue support labels before the loop. A label is the only way for break/continue to escape a nested loop to go to an outer one. ... The answer: 1. ... Every loop iteration decreases i by 1. The check while(i) stops the loop when i = 0.
Find elsewhere
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Statements › while
while - JavaScript - MDN Web Docs - Mozilla
continue stops statement execution and re-evaluates condition. The following while loop iterates as long as n is less than three. js · let n = 0; let x = 0; while (n < 3) { n++; x += n; } Each iteration, the loop increments n and adds it to x. Therefore, x and n take on the following values: ...
🌐
TechOnTheNet
techonthenet.com › js › continue.php
JavaScript: Continue Statement
You use the continue statement to restart a loop such as the while loop, for loop or for-in loop.
🌐
Savvy
savvy.co.il › blog › javascript complete guide › javascript continue statement: a complete guide
JavaScript continue Statement: A Complete Guide | Savvy
February 18, 2026 - Both break and continue statements in JavaScript are used to control the flow of loops. The break statement terminates the loop entirely, while continue skips only the current iteration and proceeds with the next one.
🌐
W3Schools
w3schools.com › js › js_break.asp
JavaScript Break
Without break, the code will continue to execute the next case blocks (and the default block if present) even if their values do not match the expression. A label provides a name for a statement, or a block of statements, allowing statements to be referenced to, for program flow control, particularly in loops.
🌐
JavaScript Tutorial
javascripttutorial.net › home › javascript tutorial › javascript continue
JavaScript continue
November 15, 2024 - The continue statement terminates the execution of the statement in the current iteration of a loop such as a for, while, and do…while loop and immediately continues to the next iteration.
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › javascript-continue-statement
JavaScript Continue Statement - GeeksforGeeks
November 19, 2024 - The continue statement in JavaScript is used to break the iteration of the loop and follow with the next iteration.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Statements › do...while
do...while - JavaScript - MDN Web Docs - Mozilla
You can use a block statement to execute multiple statements. condition · An expression evaluated after each pass through the loop. If this condition evaluates to true, statement is re-executed. When condition evaluates to false, execution continues with the statement after the do...while loop.
🌐
Tutorial Gateway
tutorialgateway.org › javascript-continue-statement
JavaScript continue Statement
March 28, 2025 - We placed the If condition inside the for loop to test whether (i%2 != 0). If this condition is True, the continue statement will execute, and the iteration will stop at that number without printing the other lines of code. If the condition is false, it will skip the continue statement and print that number as output (In Our case, Even Number) Let me use the continue Statement inside a While Loop with an example.
🌐
DEV Community
dev.to › satyam_gupta_0d1ff2152dcc › master-the-javascript-continue-statement-a-deep-dive-with-examples-use-cases-d0e
Master the JavaScript Continue Statement: A Deep Dive with Examples & Use Cases - DEV Community
September 18, 2025 - The loop then goes to the next step: i++ (so i becomes 2), and the next iteration starts with numbers2. Using continue in a while Loop The logic is identical.
🌐
W3Schools
w3schools.com › js › js_continue.asp
JavaScript Continue
let text = ""; loop1: for (let j = 1; j < 5; j++) { loop2: for (let i = 1; i < 5; i++) { if (i === 3) { continue loop1; } text += i; } } Try it Yourself »
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Statements › break
break - JavaScript - MDN Web Docs
let i = 0; while (i < 6) { if (i === 3) { break; } i += 1; } console.log(i); // Expected output: 3 · js · break; break label; label Optional · Identifier associated with the label of the statement to break to. If the break statement is not nested within a loop or switch, then the label identifier is required. When break; is encountered, the program breaks out of the innermost switch or looping statement and continues executing the next statement after that.
🌐
Codegive
codegive.com › blog › js_break_and_continue.php
Master JS Break and Continue (2024) – Unlock Efficient Loop Control & Supercharge Your Code!
5 days ago - In JavaScript, break immediately terminates a loop or switch statement, transferring control to the statement following the terminated construct, while continue skips the current iteration of a loop and proceeds to the next one. [/SNIPPET] [CONTENT] Looping through data is a fundamental task ...