Math and Number Utilities
Practice math-focused snippets: factorials, prime checks, divisors, GCD/LCM, sums, and multiplication tables. Emphasis on efficient loops and clean utility functions useful for interviews and fundamentals.
JavaScript Program to Find Sum of Natural Numbers Using Recursion
Recursive sum.
Output
JavaScript Program to Find the Square Root
Compute square root using Math.sqrt.
Output
JavaScript Program to Check Prime Number
Check divisibility up to sqrt(n).
Output
JavaScript Program to Print All Prime Numbers in an Interval
List primes in a range.
Output
JavaScript Program to Find the Factorial of a Number
Iterative factorial.
Output
JavaScript Program to Display the Multiplication Table
Multiplication table for a number.
Output
JavaScript Program to Print the Fibonacci Sequence
Generate the first N Fibonacci numbers.
Output
JavaScript Program to Check Armstrong Number
Check if sum of powered digits equals number.
Output
JavaScript Program to Find Armstrong Number in an Interval
List Armstrong numbers in range.
Output
JavaScript Program to Find the Sum of Natural Numbers
Sum 1..n.
Output
JavaScript Program to Find HCF or GCD
Euclidean algorithm.
Output
JavaScript Program to Find LCM
LCM using GCD.
Output
JavaScript Program to Display Fibonacci Sequence Using Recursion
Recursive Fibonacci.
Output
JavaScript Program to Find Factorial of Number Using Recursion
Recursive factorial.
Output
JavaScript Program to Find ASCII Value of Character
Use charCodeAt.
Output
Keep Practicing
Use the online compiler to run examples and test variations. Reinforce learning by building small scripts for each topic.
FAQ
Learn JavaScript by Practicing Examples
Hands-on practice is the fastest way to understand JavaScript. Each example above focuses on a single concept—from strings, arrays, and objects to math utilities, dates, loops, and functions. Try editing variables, adding conditions, or refactoring logic, then observe the output changes instantly.
Use our tools to deepen your learning: JavaScript Compiler to run snippets, and the JavaScript Tutorial for guided theory and practice.
Beginner-Friendly
Start with variables, operators, and control flow. Build confidence with simple, readable programs.
Practical Patterns
Practice common tasks like formatting strings, manipulating arrays, and working with dates.
Grow Skills
Advance to objects, classes, and asynchronous patterns such as promises and async/await.