#1 India's Top IT Training Institute

×

About Uncodemy

Know more about who we are and what we stand for.

About Us

About Us

Discover our mission to equip individuals with essential IT skills and industry expertise.

Read More →
UnCodeMy Gallery

UnCodeMy Gallery

Explore highlights from our IT training sessions and success stories.

Read More →
×

Free Resources

Learn, practice and plan your career — bilkul free.

Tutorials

Tutorials

Step-by-step written tutorials to learn any technology at your own pace.

Read More →
Free Counselling

Free Counselling

Book a free video counselling session and pick the right course for you.

Read More →
Online Compiler

Online Compiler

Write, run and test your code online — no setup required.

Read More →
⚡ FREE · 25 PROBLEMS WITH TESTS

JavaScript Practice Problems: Write Code, Run Tests, Get Better

Pick a problem, write a function and see which tests pass, right in your browser.

  • 🧪 Instant test results
  • 📈 10 easy, 11 medium, 4 hard
  • 💾 Progress saved

How to use the JavaScript Practice Problems

  1. 1. Pick a problemFilter by Easy, Medium or Hard.
  2. 2. Write your functionKeep the function name; replace the comment with your code.
  3. 3. Run testsSee each input, the expected output and yours.

The problems

The 25 problems cover what placement tests and front-end interviews ask most:

  • Easy (10): sum and largest of an array, reverse a string, palindrome, count vowels, FizzBuzz, factorial, even numbers, capitalise words, remove duplicates.
  • Medium (11): second largest, anagrams, character frequency, deep flatten, chunking, Two Sum, missing number, group by, most frequent word, balanced brackets, Fibonacci.
  • Hard (4): string compression, deep equality, longest substring without repeats, Roman numerals.

Each problem has 2–4 tests, including edge cases such as empty arrays and strings. A ✓ marks problems you have solved, and both your code and progress are saved in this browser.

Worked example

Problem 1 asks for sumArray(nums). A first try of return nums.reduce((a, b) => a + b); passes 2 of 3 tests: it fails on the empty array, because reduce with no starting value throws a TypeError on []. Adding the start value, reduce((a, b) => a + b, 0), gives 3 / 3 tests passed.

That is the habit these problems build: think about edge cases before you submit. Tips:

  • Use console.log inside your function; the output is shown under the results.
  • Stuck? Show a solution reveals one clear answer. Try to write it again yourself the next day.
  • Your code runs in a separate worker with a 3-second limit, so an endless loop just stops instead of freezing the page.

Frequently asked questions

How are answers checked?

Your function is called with each test's input and the result is compared as JSON with the expected output.

Is my progress saved?

Yes, in your browser's local storage on this device. Clearing site data resets it.

Can I use modern JavaScript?

Yes. Arrow functions, Map, Set, spread and other modern features all work.

Is the javascript practice problems free?

Yes, it is free. Running your first tests asks for your name and WhatsApp number once. After that, the javascript practice problems and every other Uncodemy tool open with no form.

More free tools

See all free tools