🏋️ 12 Beginner friendly Codewars challenges in JS
Tags: codenewbie, javascript, beginners
Published: 2022-01-05 18:05:50

[Codewars](https://www.codewars.com) 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](https://www.codewars.com/collections/javascript-beginners-bootcamp). 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](https://www.codewars.com/collections/61d49f93351e3f004a587719) 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?".

[>>> Solve Returning Strings<<<<](https://www.codewars.com/kata/55a70521798b14d4750000a4)

### 2. Multiply (8 kyu)

Can you fix this code?

```javascript
function multiply(a, b){
   a * b
}
```
[>>>> Solve: Multiply <<<< ](https://www.codewars.com/kata/50654ddff44f800200000004/)

## First round 
### 3. Is it a number? (8 kyu)

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

//Should return false:
isDigit("3-4")
isDigit("  3   5")
isDigit("3 5")
isDigit("zero")
```
<marquee class="calltoaction">
   <blink><a href="https://www.codewars.com/kata/57126304cdbf63c6770012bd">>>> Solve: Is it a number?<<<</a></blink>
</marquee>


### 4. Basic Mathematical Operations (8kyu)
Time for some math.

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

<marquee class="calltoaction">
   <blink><a href="https://www.codewars.com/kata/57356c55867b9b7a60000bd7/javascript">>>> Solve: Basic Mathematical Operations<<<</a></blink>
</marquee>


### 5. Opposite number (8 kyu)
Can you find an integer or a floating-point's number their opposite?

```javascript
1: -1
14: -14
-34: 34
```
<marquee class="calltoaction">
   <blink><a href="https://www.codewars.com/kata/56dec885c54a926dcd001095">>>> Solve: Opposite number<<<</a></blink>
</marquee>

## Second Round
### 6. String repeat (8kyu) 

```javascript
repeatStr(12, "A") // "AAAAAAAAAAAA"
repeatStr(5, "Hello") // "HelloHelloHelloHelloHello"
```
<marquee class="calltoaction">
   <blink><a href="https://www.codewars.com/kata/57a0e5c372292dd76d000d7e">>>> Solve: String repeat<<<</a></blink>
</marquee>


### 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.

```javascript
function howMuchILoveYou(nbPetals) {
    // Maybe a little or a lot or passionately or not at all, Can you find out?
}
```
<marquee class="calltoaction">
   <blink><a href="https://www.codewars.com/kata/57f24e6a18e9fad8eb000296">>>> Solve: I love you, a little , a lot, passionately ... not at all <<<</a></blink>
</marquee>

## 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).

[>>> Solve: Twice as old <<<<](https://www.codewars.com/kata/5b853229cfde412a470000d0)
<marquee class="calltoaction">


## 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.

[>>> Solve: Is my girlfriend right? <<<<](https://www.codewars.com/kata/5877c57388976801ad0004cb)

## 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.

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

<marquee class="calltoaction">
   <blink><a href="https://www.codewars.com/kata/57547f9182655569ab0008c4">>>> Solve: Recursive Replication<<<</a></blink>
</marquee>

## 11.  Exes and Ohs (7kyu)

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

```javascript
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
```
<marquee class="calltoaction">
   <blink><a href="https://www.codewars.com/kata/55908aad6620c066bc00002a">>>> Solve: Exes and Ohs<<<</a></blink>
</marquee>

## Finish strong

### 12. Fizz Buzz (7kyu)

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

[>>> Solve: Basic Fizz Buzz<<<<](https://www.codewars.com/kata/5300901726d12b80e8000498)

## Bonus 

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

```javascript
[]                                -->  "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"
```

<marquee class="calltoaction">
   <blink><a href="https://www.codewars.com/kata/5266876b8f4bf2da9b000362">>>> Solve: Who likes it?<<<</a></blink>
</marquee>

If you want more to solve [here's the whole JavaScript beginner-friendly collection](https://www.codewars.com/collections/61d49f93351e3f004a587719).