My solutions to challenges are too baisc and "imperative"?

My solutions to challenges are too baisc and "imperative"?
0

#1

hi there!

i have a slight problem, if you check my solutions for the basic and intermediate algorithm challenges, you will notice that all my code looks the same, specially in “Diff Two Arrays”, “Roman Numeral Converter”, “Wherefore art thou”, “Search and Replace” and “Pig Latin” challenges, the “style” is very similar even though I’m trying to solve different problems ( loops nested within loops describing how the program should work step by step in a very “manual” way ) , the code does work, but i think that i should be learning different approaches instead of just trying to pass the challenges, i did some googling and learned that my code is described as “imperative” and that i should start learning the “declarative” approach, should i stop solving challenges and start reading more JS “theory” ( I’m halfway through Jon Duckett’s JS and JQuery ) ? should i follow a course/book to broaden my JS/frontend horizons?

thanks in advance.

my FCC profile : https://www.freecodecamp.com/hostilezzz


#4

thanks a LOT! … like A LOT!,i just spent the entire day trying to perfect my solutions, i was literally doing exactly what you just warned me about… i don’t know how to thank you!


#6

I have wondered the same thing. Ive only done the basic ones and my code is as you described. I even have the john ducket book :slight_smile:

To be honest I struggle with most of the challenges.

I’m doing the weather app now and it’s been really good to do things in context. I’ve took it way too far and learned more in a week then I have over the last few months and not a loop in sight. I used mostly functions calling functions and some switches. Got a renewed outlook now and am actually looking forward to the challenges again.

I know I’m only scratching the surface but it still feels like a giant leap.

Good luck


#7

keep up the great work and good luck with the challenges!


#8

Reading this was a real boost. Thanks!


#9

To be fair, everytime i finish my solution, i do go and check how others done it, because i can see how could probably do it better. A lot of the solutions i’ve seen were needlessly overcomplicated and simply pretentious.

There was a solution with 2 for loops for example, but the blog author stated he is not keen on that solution although he did admit it runs the fastest upon testing it. This is clearly a backward approach of a problem.

There simply is no need to make things more complicated if you don’t have to.