I have a feeling I am writing useless code

So I am doing the FCC Front End Development certificate and at the moment I am on the intermediate algorithm challenges.

And I just have a feeling that my code is useless… my solutions are not as nearly as elegant and smart as the solutions in the guides (I am trying to solve them first myself and then look at the solutions).
I feel like mine are sloppy as hell. Did you have similiar feelings or something? Either I am stupid or does it get better?


Depends what you mean by “useless”.

If you mean that it won’t ever go into production and solve real world problems, that’s true. Neither will undergraduate essays be published in academic journals — does that make them “useless”?

If you mean that it’s less good than the optimal solution, that’s also true. Does that mean that a second-hand Audi is useless because it’s not a Ferrari?

If you mean that it doesn’t do what it’s supposed to do, that’s false (assuming you’re passing the challenges and the tests aren’t buggy).

And if you mean that the knowledge you’re gaining won’t ever have a positive impact on the world, that all depends on what you choose to do with it. If you give up now, it certainly won’t.


You’re not stupid, and it definitely gets better. You’ll become more comfortable with advanced syntax in time. You’ll also learn programming patterns and strategies that will help you solve problems more easily. Don’t stress over it, just keep doing what you’re doing.


I have not seen the guides but I’m pretty sure they are the result of many hours of review, tests and rework - you should adopt a similar approach to your solutions - after you have a working solution go over it yourself or have someone review it for improvements - don’t do it immediately though because it’s better to keep moving on to new problems - as you solve harder problems you will learn and appreciate better techniques that you can apply to earlier solutions


Your first few solutions won’t look as elegant as your future solutions however it’s essential to your learning. Just keep working to improve your code and you’ll have more elegant solutions by default in no time :slight_smile:


I hope so, thanks for the heads up :slight_smile:

This is really good advice. Compare your code to the model answers in the wiki and think carefully about where they differ, why the authors of the model answers chose to do things the way they did. You’ll almost always learn something valuable from it.

This process is what journalist Joshua Foer calls “studying yourself failing” — really examining the ways in which you’re falling short of where you want to be, rather than accepting your current state as “just about good enough”.

Bear in mind that in the tech industry, “failing” isn’t a dirty word. This is the industry where the mantra “fail fast, fail often” has been used so often it’s become a cliché.


I am doing the Adv. Algorithms and at a stage of my journey where I am thrilled to be able to solve the challenges at all. At some point, I will advance to a point where being able to solve it wont be the challenge, instead it will be being able to solve it in a more elegant way.

I actually look forward to being able to check out my previous code and with new knowledge be able to write it so much better…that to me will be an awesome sign of progress… But for now, considering 3 months ago I could never…ever solve the challenges Im working on now, I dont feel stupid at all when I look at my code, on the contrary, Im pretty proud of myself for finding a solution and you should be too.

1 Like

Yeah that’s what I am hoping for :smiley: But the thing that in FCC it’s not first time I’m coding, I’d say it’s the first time I’m taking it more seriously, I am in high school not even graduated yet so this is my pure interest in computers as I will probably go for a CS degree If I manage.

I started FCC mainly because I am hella intersted in the non-profit projects for real companies and maybe If I learn to make websites better I could make some money through freelance projects.

Yeah Ill say, a thing about a more structured envrionment like this and learning totally on your own is that on your own, you tend to focus on learning the things you need for whatever particular project or task you are trying to achieve, with no checks and balances for how well you are actually coding, only that you are able to get the task done.

Thats not a bad thing at all actually, so dont even stress if you are feeling challenged even after coding for awhile, youre just working different muscles, so to speak, and picking up on new information that you just hadn’t learned on your own yet.

I also really like the idea of being able to collaborate on a not for profit project…its a great end goal to work towards here.

1 Like

@Jacobs322 and all Naysayers with doubt

When this feeling of useless, improper-coding becomes overwhelming, and your moral compass considers doing what most certainly feels like cheating to you, but, Ughh! you’re so freaking frustrated!!! Why doesn’t This code work? Soooo, that’s when you tell yourself, “Well maybe i’ll just take a teeny-weenie little peek… Yeah, that’s all, I just want to see what they did. Yeah, I’m just looking. I got this”

Well, now your just, perrrrusing around, in another hard-working programmer’s fully functional and completed code. When suddenly, you hear a faint creaking voice tell you, “I knew you couldn’t do it”. What!!! Did this code just take a crack at me? Well we most certainly can’t have that now can we!!!

   		<boom!> Copy & Paste </boom!>

So now you got the code… Might as well test it right? Deep down your hoping it fails too, and this challenge is FreeCodeCamp’s version of the Kobyashi Maru, and all who try are destined to fail…

                  `| Run tests (ctrl+enter) |`

Nope… Worrrks jusssst fiiiine. Even has comments tucked in there real pretty just like mommas notes in your 3rd grade lunchbox. - :nerd_face: -

Now ask yourself,

Aren’t you the least bit curious why this code works and yours just bombed… Big Time?

If not,

you may be in the wrong place along with your account here forced into early retirement…

If yes,

Welcome! Please stay a while, there are some refreshments and snacks located in the back.

Next, you begin disecting it and changing variables, trying to implement even the smallest fragment from your own original failed code?

See! Now you’re learning… May seem mind-numbingly slow on top of your recently bruised ego, but none the less, you are correcting mistakes and the healing process may begin.

  • Deep Breath! Now, exhale through the nose.

Secretely you make a mental note on how to find it again, to one day return and manipulate it with your now mediocre-skills?
- so it simply rue’s the day it snickered at you!

…Well, maybe that part is just the evil villian inside me…

No one is expected to retain every bit of this the first time around. I am only 1 year into my Associates Degree for Programming. Unlike the other courses I am taking, the only available Intro to Programming courses available were not only online classes, but the Professor I chose ( @hectorsector - who was great btw) also works for github. The course included completing the better half of front end developement certification from here, along with learning how to work with github, and a few others projects. I felt lost 80% of the time. But I would research info from websites like w3schools along with the mozilla links given inside the challenges. And I have to say that I am now, 85% lost on what I am doing.

  • Scored 105% final grade for the course with my extra credit - :nerd_face: -

It hasn’t happened to me yet, but I am positive that one day, when I get all growed up, and someone uses 1 binary fragment of my code I personally put together, ( Obviously my team of lawyers will just sue the pants off of them! ) my head, will swell sooo BIG, that FreeCodeCamp will be forced to create a second forum just for it!

Who knows? We’ll see.

  • Good luck to all and keep up the hard work!

I feel we’ve all been there, and I certainly feel like that more often than not.
But that’s part of the learning process. Compare to 6 months ago where I could only think in basic for loops I now now handy JS methods and ES6 that makes me write (sometimes) elegant code.
Point is, you will get better with time and your code may be inefficient right now but by no means is it useless.
Keep at it! :wink:

1 Like

my solutions are not as nearly as elegant and smart as the solutions in the guides (I am trying to solve them first myself and then look at the solutions)

I teach guitar for my day job. Inevitably we get to soloing, be it rock, blues, or jazz. I always tell my students, “If you want to learn to solo well, first you’ve got to play a lot of bad solos.”

There’s not pill you can take, there’s not short cut. You are going through what everyone goes through. If you keep at it, it will get better.

Trying to solve them first and then checking out other people’s solutions - that’s a great approach. And check out more than one - often there’s more than one good solution. And then maybe see if you can recreate the “better” solution from memory a week later.

It sounds like you’re on the right track. Your only mistake would be letting your frustration get the better of you.


Guys thank you so much for the motivation!
Have a good time coding!

Feeling the same often times. Mam to podobne :slight_smile:
Trying to study better solutions and learn from them.


I really like your advice, thanks a lot

1 Like

Keep doing what you are doing - you are exercising the problem solving areas of your brain which is way more valuable than rote memorization. Elegance will follow and you will bring invaluable alternative solutions as a team member.


Please don’t be so hard on yourself.
The fact that you have solutions to the problems is the most important.
My philosophy to making things is "make it work, then make it pretty."
That came out of my life experiences, and I am sure that most people will agree with me.
That is even more so with something as arcane as computer programming that forces you to construct your thoughts in a language that you are not accustomed to. The rules and some of its symbols are completely new to novice programmers like us so it is inevitable that we will stumble along the way.
The beautiful thing about projects such as FCC is that we can learn from other as we do the projects. I solve the problems on my own first then compare my solutions to other here.
Like you my code is usually not as elegant as most but comparing them is a vital part of the learning here.
As a case in question here is my solution to them palindrome problem.

function palindrome(str) {
// Good luck!
var strArray = [];
var reverseArray = [];
var newStr = [];

str = str.replace(/[\W_]/g, ‘’).toLowerCase();
strArray = str.split(’’);
newStr = strArray.reverse();
rStr = newStr.join(’’);
if (str === rStr ){
return true;
else {
return false;



Yes, it is yacky, but it worked. I can now focus on making it better and become a better programmer.


1 Like

Yeah thanks, your advice is similiar to others’ and I’ll definitely try to stick to the ‘first make it work, then make it pretty’.

Thank you very much :slight_smile:

Shouldn’t you be saying “else if”? :stuck_out_tongue: