Skip to content

πŸš€ 28 Mini JavaScript Exercises - A collection of small, hands-on coding challenges designed to sharpen your JavaScript skills. Perfect for beginners and intermediate developers looking to practice and improve their understanding of core concepts. Dive in and start coding! πŸ’»

Notifications You must be signed in to change notification settings

Wahaj-Developer/Mini-JavaScript-Exercises

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

97 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

JavaScript Code Examples This repository contains a collection of JavaScript code snippets that demonstrate various programming concepts and techniques. Below is a summary of the examples included:

  1. Basic Output Print "Hello World": Demonstrates three ways to print "Hello World" using console.log, alert, and document.write.

  2. Basic Arithmetic Adding Two Numbers: Simple addition of two numbers and displaying the result.

User Input Addition: Takes two numbers from the user and calculates their sum.

  1. Mathematical Operations Square Root: Calculates the square root of a number provided by the user.

Area of a Triangle: Calculates the area of a triangle using base and height, and also using Heron's formula for any type of triangle.

  1. Swapping Values Swapping with Temporary Variable: Swaps the values of two variables using a temporary variable.

Swapping without Temporary Variable: Swaps the values of two variables without using a temporary variable.

  1. Unit Conversion Kilometers to Miles: Converts kilometers to miles (implementation available in HTML file).

Celsius to Fahrenheit: Converts Celsius to Fahrenheit (implementation available in HTML file).

  1. Number Checking Positive, Negative, or Zero: Checks if a number is positive, negative, or zero using Math.sign() and if-else statements.

Even or Odd: Determines if a number is even or odd using if-else and ternary operator.

  1. Prime Number Check Prime Number: Checks if a number is prime or not.

  2. Largest Number Largest of Three Numbers: Finds the largest number among three numbers using Math.max() and a custom function.

  3. Factorial Calculation Factorial: Calculates the factorial of a number using a loop and recursion.

  4. Multiplication Table Multiplication Table: Prints the multiplication table of a number.

  5. Armstrong Number Armstrong Number: Checks if a number is an Armstrong number.

Armstrong Numbers in an Interval: Finds all Armstrong numbers within a given interval.

  1. Palindrome Check Palindrome: Checks if a string is a palindrome using array methods and for loops.

  2. Character Occurrence Character Occurrence: Counts the number of occurrences of a specific character in a string.

  3. String Operations Starts and Ends With: Checks if a string starts and ends with specific characters.

Substring Check: Checks if a string contains a specific substring.

Capitalize First Letter: Converts the first letter of a string to uppercase.

  1. Vowel Count Count Vowels: Counts the number of vowels in a string using regular expressions.

  2. Sum of Natural Numbers Sum Using Recursion: Calculates the sum of natural numbers using recursion.

  3. Factors of a Number Factors: Finds all factors of a given number.

  4. Simple Calculator Calculator: A simple calculator using switch-case to perform basic arithmetic operations.

  5. Fibonacci Sequence Fibonacci Sequence: Generates the Fibonacci sequence up to a specified number of terms.

  6. String Manipulation Replace Characters: Replaces specific characters in a string using replace() and regular expressions.

Reverse String: Reverses a string using a loop.

  1. Sorting Sort Words Alphabetically: Sorts words in a string in alphabetical order.

About

πŸš€ 28 Mini JavaScript Exercises - A collection of small, hands-on coding challenges designed to sharpen your JavaScript skills. Perfect for beginners and intermediate developers looking to practice and improve their understanding of core concepts. Dive in and start coding! πŸ’»

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published