The Top 5 JavaScript Coding Challenges for Beginners

Preparation strategy for 2023


4 min read


Coding challenges are a great way to enhance your coding skills and improve your problem-solving abilities. If you have a basic understanding of JavaScript, these challenges are suitable for you. If you don't have this foundation, consider completing a course like or finding a helpful playlist on YouTube.

So without further ado, lets dive right into some challenges:

Coding Challenge #1: Print Numbers in Reverse

Given any integer number, print all the numbers in reverse till 0.


// input = 10
// output = 10 , 9 , 8 , 7, 6, ... 0

function reverse(input) {
    // Write your logic here;

To solve this problem you’d need knowledge on Loops.

If you can’t solve this right at this moment don’t worry everyone has passed this stage. Now head to this link to learn about loops in JavaScript and try again.

for - JavaScript | MDN

Coding Challenge #2: Convert from Celsius to Fahrenheit

Remember the physics lesson on temperature where we used a formula to convert Celsius to Fahrenheit? This problem is the exact representation of the formula in a program.


Write a function that takes in a temperature in Celsius and returns the equivalent temperature in Fahrenheit.


  • convertToFahrenheit(0) should return 32

  • convertToFahrenheit(100) should return 212

  • convertToFahrenheit(37) should return 98.6


  • The input temperature will be a positive integer or decimal in the range [-100, 100].

  • The output temperature should be rounded to the nearest hundredth.


  • The formula for converting Celsius to Fahrenheit is: F = C * 9/5 + 32

Here you need knowledge on Variables and Operators. This will help you build your logical skills and put your mathematical skills to test.

#Hint1: If you need a refresher on variables and operation head to this link.

Coding Challenge #3: Reverse a String

Write a function that takes in a string and returns the string with the characters in reverse order.


  • reverseString('hello') should return 'olleh'

  • reverseString('abcdefg') should return 'gfedcba'

  • reverseString('racecar') should return 'racecar'


  • The input string will only contain alphabetical characters and will have at most length 100.


  • You should not use the built-in reverse() method for strings.

  • Your function should be able to handle palindromes (strings that are the same forwards and backwards).

You can solve this challenge if you have paid some attention to the #1 challenge in this post.

Hint: Read the string from the end and append to an empty string;

If you need some refresher on properties and built in functions of strings, head to this post by w3schools

Coding Challenge #4: Check for Anagrams


Write a function that takes in two strings and determines if they are anagrams of each other. An anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once.


  • isAnagram('listen', 'silent') should return true

  • isAnagram('hello', 'world') should return false

  • isAnagram('anagram', 'nagaram') should return true


  • The input strings will only contain alphabetical characters and will have at most length 100.

  • The strings may not be case sensitive, so you should ignore the case of the characters when determining if they are anagrams.


  • You should not use the built-in sort() method for strings.

  • Your function should be able to handle anagrams that are palindromes (words that are the same forwards and backwards).

This is a tough one. So you better start thinking about how you can store or know if all the characters present in word1 is also present in word2.

Incase you are completely stuck start writing on paper or watch a video on YouTube.

Reference :

Coding Challenge #5: Calculate the sum of numbers in an array of numbers

Write a function that takes in an array of numbers and returns the sum of all the numbers in the array.


  • sumArray([1, 2, 3]) should return 6

  • sumArray([10, 20, 30, 40]) should return 100

  • sumArray([-1, -2, 3]) should return 0


  • The input array will contain at most length 1000.

  • The numbers in the array may be positive, negative, or zero.


  • You should not use the built-in sum() method for arrays.

There are multiple ways to solve this, but the foundation of this challenge is store the data iterate through the array.

Here’s the link to learn about iteration on array:


These are the most beginner friendly challenges for you. Try to complete all of them without looking up the solution. Even if you are looking for the solution then do make notes about how did it work.

Consistency is the key to become a better programmer and no one has learned without practising daily. I wish you all the best.

If you liked what I post do follow me on Twitter. This will support and encourage me create more content like this.

See you next time.

Did you find this article valuable?

Support Sagar by becoming a sponsor. Any amount is appreciated!