🌐
Medium
medium.com › @francesco-saviano › 10-exercises-with-while-loops-in-javascript-8cfb2bd81a71
10 Exercises with While Loops in JavaScript | by Francesco Saviano | Medium
October 24, 2024 - The task is to write a JavaScript program that uses a while loop to print numbers from 1 to 10. This exercise will help you understand how to use the while loop for iterating over a sequence of numbers.
🌐
Exercism
exercism.org › tracks › javascript › concepts › while-loops
While Loops in JavaScript on Exercism
Depending on the environment in which such code runs, this will be done automatically or needs manual intervention. let i = 0; while (i < 100) { if (i % 3 === 0) { continue; } i = i + 2; } // This loop runs forever since the variable i does ...
Discussions

Beginner Friendly Exercises for practicing JavaScript For and While Loops?
FizzBuzz is a classic: https://leetcode.com/problems/fizz-buzz/description/ More on reddit.com
🌐 r/ADHD_Programmers
7
6
May 10, 2024
FAQ: Loops - The While Loop
This community-built FAQ covers the “The While Loop” exercise from the lesson “Loops”. Paths and Courses This exercise can be found in the following Codecademy content: Web Development Introduction To JavaScript FAQs on the exercise The While Loop There are currently no frequently asked ... More on discuss.codecademy.com
🌐 discuss.codecademy.com
0
0
November 23, 2018
Exercise loop "while" - JavaScript - Stack Overflow
I am stuck on a task. The exercise is based on the "while" loop. This is what i need to get as output using a variable that changes the numbers and simply printing "Case" and "Notes". Case 1 : 1 ... More on stackoverflow.com
🌐 stackoverflow.com
Beginner working through Eloquent Javascript having a challenging time. Any suggestions for me?
I don't know if this will help but there's an annotated version of it by Gordon Zhu, https://docs.google.com/document/d/1aa2-HtUglQrAps31s4LdTPVsiFb1BxhyjZolxeezzcI/ The same person also made a very beginner friendly course called Practical JavaScript http://watchandcode.com/p/practical-javascript which I am taking now. More on reddit.com
🌐 r/learnjavascript
14
16
October 30, 2016
🌐
Contactmentor
contactmentor.com › js-loop-exercises-solutions
17 JavaScript for/while loop exercises with solutions – Contact Mentor
var arr = [13,45,34,2,56,3,57,34,88,55]; var key=57; var low=0; var high=arr.length-1; var mid=0; var flag=0; arr.sort() console.log("The sorted array is: "+arr); //13,2,3,34,34,45,55,56,57,88 while(low<=high) { mid=Math.floor((low+high)/2); if(key < arr[mid]) { high=mid-1; } else if(key > arr[mid]) { low=mid+1; } else if(key == arr[mid]) { flag++; console.log("found at index:"+mid); //print the position break; } } if(flag==0) { console.log("Not found"); // Element not present in array } JavaScript Loop tutorials · Watch this video on YouTube. 10 Examples for Recursion in JavaScript · 10 JavaScript If else exercises with solution ·
🌐
W3Schools
w3schools.com › js › js_loop_while.asp
JavaScript While Loop
JS Examples JS HTML DOM JS HTML ... JS Interview Prep JS Bootcamp JS Certificate ... While loops execute a block of code as long as a specified condition is true....
🌐
W3Resource
w3resource.com › javascript-exercises › javascript-conditional-statements-and-loops-exercises.php
JavaScript conditional statements and loops - Exercises, Practice, Solution - w3resource
July 10, 2025 - Practice with solution of exercises on JavaScript conditional statements and loops; exercise on if else, switch, do while, while, for, for in, try catch and more from w3resource.
🌐
Home and Learn
homeandlearn.co.uk › javascript › javascript_while_loops.html
Javascript While Loops
Exercise Use a while loop to print out the even number from 1 to 20. (You'll need Modulus for this.
🌐
W3Schools
w3schools.com › js › exercise_js.asp
W3Schools JS Exercise
Exercise 1 Exercise 2Go to JS While Loops Tutorial · JS Break Loops · Exercise 1 Exercise 2Go to JS Break Loops Tutorial · JS HTML DOM · Exercise 1 Exercise 2 Exercise 3 Exercise 4 Exercise 5 Exercise 6 Exercise 7 Exercise 8 Exercise 9Go to JS HTML DOM Tutorial · × · This will reset the score of ALL 67 exercises. Are you sure you want to continue? Reset Cancel · × · Share your score: Take our JavaScript Developer Certificate to prove that you have fundamental knowledge of web development using JavaScript.
🌐
NotesforMSc
notesformsc.org › home › javascript – exercise 10 : the while loop
JavaScript - Exercise 10 : The While Loop - Notesformsc
November 8, 2025 - The JavaScript code that we are going to use is as follows. var i=0; while(i<=5) { document.write("<h3>" + "The Value of I is" + i + "</h3>"); i++; } The while loop has the statement ‘The Value of I is + i’ which is repeated n times when the loop executes.
Find elsewhere
🌐
Learn JavaScript
learn-js.org › en › Loops
Loops - Learn JavaScript - Free Interactive JavaScript Tutorial
For example, we can create a loop that loops forever using while(true) and use the break statement to break inside the loop instead by checking that a certain condition was met.
🌐
LinkedIn
linkedin.com › pulse › mastering-javascript-understanding-while-loops-laurence-svekis-
Mastering JavaScript: Understanding While Loops
September 22, 2023 - Conclusion: while loops are powerful tools for automating repetitive tasks in JavaScript. They are especially useful when the number of iterations is unknown or based on a dynamic condition. However, be cautious to avoid infinite loops by ensuring the condition eventually evaluates to false. Here are 10 coding exercises to help you practice while loops in JavaScript:
🌐
Reddit
reddit.com › r/adhd_programmers › beginner friendly exercises for practicing javascript for and while loops?
r/ADHD_Programmers on Reddit: Beginner Friendly Exercises for practicing JavaScript For and While Loops?
May 10, 2024 -

I’ve been on a self-teaching journey for months learning html, css and now JavaScript. By some miracle, I’ve been able to learn the basics of some JavaScript concepts and unfortunately fell into a bit of a ditch with learning for and while loops in JavaScript. It was suggested to me (through a coding community) that I avoid practicing the blend of arrays and loops until I fully understand the basics of loops. So far I’ve been pulling through learning JavaScript through building super small and simplified things but I’ve been struggling to find good exercises online and via chat GPT that practice loops without the integration of arrays.

The only two possible exercises I saw was to

  1. code a loop that counts to a certain number and

  2. code a loop that displays a message beside all even numbers within a loop that has a range of numbers (i.e 1-10)

Does anybody else here learning web development have any valuable resources they can share surrounding loops?

I’m usually more of a visual learner and have a reputation for being horrible at math but I’m very determined to find a way to understand loops that makes sense in my ADHD brain and would appreciate any assistance. :)

🌐
Codecademy
codecademy.com › forum_questions › 532cd8e2548c35707d001e57
Lesson 7 Exercise 5 Javascript While Loop | Codecademy
var loop = function() { var loops = 0; while(loops < 3) { //Your code goes here! console.log(“I’m looping!”); //Logs string to console. loops++; //Adds 1 to loops } }; ... the recomended order to learn is html + css first, followed by ...
🌐
Codecademy Forums
discuss.codecademy.com › frequently asked questions › javascript faq
FAQ: Loops - The While Loop - JavaScript FAQ - Codecademy Forums
November 23, 2018 - This community-built FAQ covers the “The While Loop” exercise from the lesson “Loops”. Paths and Courses This exercise can be found in the following Codecademy content: Web Development Introduction To JavaScript …
🌐
LaunchCode
education.launchcode.org › intro-to-web-dev-curriculum › loops › exercises › index.html
Exercises: Loops :: Introduction to Web Dev
August 28, 2023 - The loop should continue until the user enters a positive value greater than 5000 but less than 30000. const input = require('readline-sync'); let fuelLevel = 0, numAstronauts = 0, altitude = 0; while (fuelLevel <= 5000 || fuelLevel > 30000 || isNaN(fuelLevel)) { fuelLevel = input.question("Enter the starting fuel level: "); }
🌐
Codecademy
codecademy.com › learn › introduction-to-javascript › modules › learn-javascript-loops › cheatsheet
Learn JavaScript: Loops Cheatsheet | Codecademy
... A for loop can iterate “in ... ... A do...while statement creates a loop that executes a block of code once, checks if a condition is true, and then repeats the loop as long as the condition is true....
🌐
BigBinary Academy
courses.bigbinaryacademy.com › learn-javascript › loops › exercise-do-while-loop
Exercise - do...while loop - Learn JavaScript | BigBinary Academy
The code given below displays **"Hello, World!"** in the console. Enclose the `console.log` statement in a **do...while loop**, such that it displays **"Hello, World!"** `3` times.
🌐
Programiz
programiz.com › javascript › while-loop
JavaScript while and do...while Loop (with Examples)
The JavaScript while and do…while loops repeatedly execute a block of code as long as a specified condition is true. In this tutorial, you will learn about the JavaScript while and do…while loops with examples.
🌐
Codecademy
codecademy.com › courses › introduction-to-javascript › lessons › loops › exercises › do-while-statement
| Codecademy
Codecademy is the easiest way to learn how to code. It's interactive, fun, and you can do it with your friends.
🌐
LaunchCode
education.launchcode.org › intro-to-professional-web-dev › chapters › loops › exercises.html
9.9. Exercises: Loops — Introduction to Professional Web Development in JavaScript documentation
Prompt the user to enter the starting fuel level. The loop should continue until the user enters a positive value greater than 5000 but less than 30000.