This repository contains basic JavaScript exercises. Each exercise focuses on a different fundamental concept in JavaScript, including:
- Function operations
- Variables usage
- Loop structures
- Conditionals
- isEven(number): Checks if a number is even.
- factorial(n): Computes the factorial of a number.
- isPrime(n): Checks if a number is prime.
- fibonacci(n): Computes the nth number in the Fibonacci sequence.
- gcd(a, b): Finds the greatest common divisor of two numbers.
- power(base, exponent): Computes the base raised to the power of the exponent.
- isPalindrome(string): Checks if a string is a palindrome.
- countChar(string, char): Counts the number of times a character appears in a string.
- sumDigits(n): Computes the sum of the digits of a number.
- reverseString(string): Reverses a string.
We use Jest for testing. To run the tests, navigate to the project directory in your terminal and run:
npm test