Skip to content

This repository contains a collection of JavaScript coding challenges that are designed to help you improve your skills and test your knowledge of the language. Each challenge is accompanied by a README file that explains the problem statement, input/output, and any additional requirements.

License

Notifications You must be signed in to change notification settings

theRamCoder/js-coding-challenges

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JS Coding Challenges

ComputeNepal - js-coding-challenges stars - js-coding-challenges forks - js-coding-challenges

License issues - js-coding-challenges

contributions - welcome

View site - GH Pages

js-coding-challenges

This repository contains a collection of JavaScript coding challenges that are designed to help you improve your skills and test your knowledge of the language. Each challenge is accompanied by a README file that explains the problem statement, input/output, and any additional requirements.

The answers will be available in /solutions/problem_title/answer.js while the explanation will be given in /solutions/problem_title/readme.md.

Make sure to star the repository if you find it useful. And contributions to the repository are welcome.

Challenge 1: FizzBuzz

Write a program that prints the numbers from 1 to 100. But for multiples of three, print "Fizz" instead of the number and for the multiples of five, print "Buzz". For numbers which are multiples of both three and five, print "FizzBuzz". For example, your program should print:

1
2
Fizz
4
Buzz
Fizz
7
8
Fizz
Buzz
11
Fizz
13
14
FizzBuzz
16
...

Answer

Solution Explanation

Challenge 2: Palindrome Checker

Create a function that takes a string as an argument and returns true if it's a palindrome and false if it's not. A palindrome is a word, phrase, number, or other sequence of characters that reads the same forward and backward. For example, "racecar" is a palindrome, but "hello" is not.

Answer

Solution Explanation

Challenge 3: Fibonacci Series

Write a function that takes a number n as input and returns the first n numbers in the Fibonacci sequence. The Fibonacci sequence is a series of numbers in which each number is the sum of the two preceding numbers. The first two numbers in the sequence are 0 and 1. For example, if n is 5, the function should return the array [0, 1, 1, 2, 3].

Answer

Solution Explanation

Challenge 4: Find the Longest Word

Write a function that takes a string and returns the longest word in the string. If there are two or more words that are of the same length, return the first one that appears in the string. For example, if the input string is "The quick brown fox jumps over the lazy dog", the function should return "quick".

Answer

Solution Explanation

Challenge 5: Reverse a String

Write a function that takes a string as input and returns the string reversed. For example, if the input string is "hello", the function should return "olleh".

Answer

Solution Explanation

Challenge 6: Capitalize the First Letter of Each Word

Write a function that takes a string as input and returns the string with the first letter of each word capitalized. For example, if the input string is "the quick brown fox", the function should return "The Quick Brown Fox".

Answer

Solution Explanation

Challenge 7: Check for Prime Numbers

Write a function that takes a number as input and returns true if it's a prime number and false if it's not. A prime number is a natural number greater than 1 that is not a product of two smaller natural numbers. For example, 2, 3, 5, 7, 11, and 13 are prime numbers, but 4, 6, 8, and 9 are not.

Answer

Solution Explanation

Challenge 8: Sum of Digits

Write a function that takes a number as input and returns the sum of its digits. For example, if the input number is 123, the function should return 6 (1 + 2 + 3 = 6).

Answer

Solution Explanation

License

Released under MIT by @ComputeNepal.

Website - Visit ComputeNepal

About

This repository contains a collection of JavaScript coding challenges that are designed to help you improve your skills and test your knowledge of the language. Each challenge is accompanied by a README file that explains the problem statement, input/output, and any additional requirements.

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%