Stefi Rosca

🏋️ 12 Beginner friendly Codewars challenges in JS

Codewars katas, coding exercises, felt really intimidating. Even though I started with small easier challenges in the last weeks of my bootcamp at first I struggled. I didn’t really understand what the kyu’s were and wasn’t sure where to start. Luckily I found a collection of Javascript beginners bootcamp katas. After completing these I still didn’t feel ready for interviewing and I decided to keep going.

The more challenges I solved the more comfortable I felt and I was able to take on some from different levels. I put together a list of 21 Codewars katas in the hope this can help others on their learning journey. Here are 12 of them:

Warm up

1. Returning Strings (8 kyu)

A small fun kata to get you started.

Description: Make a function that will return a greeting statement that uses an input; your program should return, "Hello, <name> how are you doing today?".

2. Multiply (8 kyu)

Can you fix this code?

function multiply(a, b) {
  a * b
}

First round

3. Is it a number? (8 kyu)

//Should return true:
isDigit("3")
isDigit("  3  ")
isDigit("-3.23")

//Should return false:
isDigit("3-4")
isDigit("  3   5")
isDigit("3 5")
isDigit("zero")

4. Basic Mathematical Operations (8kyu)

Time for some math.

//Examples(Operator, value1, value2) --> output
;("+", 4, 7)-- > 11("-", 15, 18)-- > -3("*", 5, 5)-- > 25("/", 49, 7)-- > 7

5. Opposite number (8 kyu)

Can you find an integer or a floating-point’s number their opposite?

1: -1
14: -14
-34: 34

Second Round

6. String repeat (8kyu)

repeatStr(12, "A") // "AAAAAAAAAAAA"
repeatStr(5, "Hello") // "HelloHelloHelloHelloHello"

7. I love you, a little , a lot, passionately … not at all (8kyu)

Do you remember the flowers and petals game? Felt a bit nostalgic solving this one.

function howMuchILoveYou(nbPetals) {
  // Maybe a little or a lot or passionately or not at all, Can you find out?
}

8. Twice as old (8kyu)

Let’s have some fun!

Your function takes two arguments:

current father’s age (years) current age of his son (years) Сalculate how many years ago the father was twice as old as his son (or in how many years he will be twice as old).

Third Round

9. Is my girlfriend right? (8kyu)

As with any enduring relationship, your function should be resilient to all manners of arguments and outside influences.

A tricky one worth solving.

10. Recursive Replication (7kyu)

Ready to solve this challenge with recursion?

For example replicate(3, 5) should return [5,5,5]. If the times argument is negative, return an empty array.

function replicate(times, number) {
  // your solution here
}

11. Exes and Ohs (7kyu)

Check to see if a string has the same amount of ‘x’s and ‘o’s.

XO("ooxx") => true
XO("xooxx") => false
XO("ooxXm") => true
XO("zpzpzpp") => true // when no 'x' and 'o' is present should return true
XO("zzoo") => false

Finish strong

12. Fizz Buzz (7kyu)

A quite popular kata among beginners. Have you solved this one yet?

Bonus

Who likes it? (6kyu, I’d give it a 7kyu)

[]                                -->  "no one likes this"
["Peter"]                         -->  "Peter likes this"
["Jacob", "Alex"]                 -->  "Jacob and Alex like this"
["Max", "John", "Mark"]           -->  "Max, John and Mark like this"
["Alex", "Jacob", "Mark", "Max"]  -->  "Alex, Jacob and 2 others like this"

If you want more to solve here’s the whole JavaScript beginner-friendly collection

Read More:


👩‍💻 Frontend Developer, 🌍 traveler and⛷️ Skier

Recurse Center Alumn

Stefi Rosca © 2024