## DEV Community

Florin Pop

Posted on • Updated on

# JavaScript Coding Challenges

When it comes to programming, I am a big fan of two things: JavaScript and Coding Challenges! And I can't be happier than when I'm able to combine these two! π

I've (re)started recently to not only play with different Coding Challenges on sites like HackerRank, CodeWars or CodeSignal, but I'm also writing my own solutions with explanation for these challenges on my blog.

You can find a list of all the different Coding Challenges that I've tackled and solved using JavaScript:

If you are interested in solving the challenges, make sure that you solve them on your own before reading the solution as this will help you learn much more in the long run. By doing so at the end you might end up having two solutions for the same problem, which is a double win! π

I'm planning to write more blog posts in the future on this topic and I'd love to get your opinion on it. Is this something you are interested in reading? Are you also a fan of Coding Challenges? What about JavaScript?

All the feedback is highly appreciated! Thank you, amazing community of devs! π

P.S. I'm going to update this list whenever I'm writing a new blog post, so if you are interested in reading more, make sure that you bookmark this post or you visit the challenges section on my blog often. (Or you can receive these posts directly into your inbox by clicking here).

Sundeep • Edited

heads up, you've got a typo - missing 'c' in `Regular Brakets`

I have a few beginner to intermediate level exercises for Python - you could translate them to Javascript if you are interested :)

I also have some resource links for practice ideas and sites - might help you get more challenges to solve

mehdibenhemdene

Suggested alternative solution for "Where do I belong" using `Array.prototype.filter`:

``````var array = [1, 2, 3, 4];

function getIndexToIns(arr, number) {
let result = arr.sort().filter(el => el <= number).length;
return result;
}

console.log(getIndexToIns(array, 8));
``````

mehdibenhemdene

Also a simple "Destroyer" implementation:

``````function destroyer(arr, ...params) {
return arr.filter(el=>!params.includes(el));
}

``````

Ram Newton
``````function destroyer(arr, ...params){
params_set = new Set(params);
return arr.filter(item => !(params_set.has(item)))
};
``````

.includes() does a linear search. Creating a set out of the parameters and using the .has() method will improve performance

Matt MacPherson

Check out Edabit; I think you'll like it.

Ricardo Pedroso

Thanks for the post, I had a lot of fun going through these exercises!

For the phone number one, I'll leave here my one line solution:

Have a nice day :)

Deepak Pal

Florin Pop

My pleasure! βΊοΈ

Daniel Med

Thank you so much for that , as a developer I think the only way to define you level is by solving coding challenges , hope we see some other challenges

Florin Pop

This is what Iβm planning to do! π

Rahul Parshi

Nice idea and it will be helpful in interviews also as we can explain them more clearly..

Florin Pop

Exactly! Very happy to help! βΊοΈ

Daniel Borowski

Check out Coderbyte, lots of coding challenges and interview prep material!