Course offer · HLD · LLD · System Design at ₹799 until 30 Nov (not interview packs)

ProgramsJavaScript

JavaScript Loop Programs

Practice JavaScript loops like for and while. Build tables, factorials, Fibonacci series, prime checks and number patterns, with step-by-step help and output.

6 programs · open one, then the next

Start with Multiplication Table
  1. 01Multiplication TableBeginnerPrint a multiplication table in JavaScript using for and while loops and a reusable function. Covers off-by-one bugs, with explanation and output.Open example →
  2. 02Sum of n Natural NumbersBeginnerFind the sum of the first n natural numbers in JavaScript with a for loop, while loop, reduce and the n(n+1)/2 formula. Clear explanation and output.Open example →
  3. 03Factorial of a NumberBeginnerFind the factorial of a number in JavaScript with a for loop, recursion, while and reduce. Learn why 0! is 1 and when to use BigInt. Explanation and output.Open example →
  4. 04Reverse a NumberBeginnerReverse a number in JavaScript using % 10 and Math.floor, string methods and negative support. Learn why 100 becomes 1, with explanation and output.Open example →
  5. 05Palindrome CheckBeginnerCheck if a number or word is a palindrome in JavaScript using string reverse, digit math, two pointers and recursion, with explanation and output.Open example →
  6. 06Prime Number CheckIntermediateCheck if a number is prime in JavaScript with trial division up to the square root. Lists primes in a range and factors of 60, with explanation and output.Open example →