Is my problem solving flawed? Help!

I tend to find ways of solving challenges based on loops, which tends to lead to some crazy answers when there are easier ways of solving the problems.

I just finished the Confirm Ending challenge, and I never thought to use .slice() or a regex. I used a while loop and an if/else statement to look at the end and compare.

My question is: Is this an issue or an attribute?

My end goal is to find a job writing code, so I am afraid I am engraining an incorrect approach to solving coding problems.

Any feedback would be greatly appreciated.


it is always good to know how to solve a problem using just the fundamentals

but after that you could try to make your code more readable by using methods with a specific function
maybe a loop is more efficient but depending on what you are writing, using an higher level of abstraction (as in finding a method that does that thing for which you have written a few lines of code) make it more fruibile by other developers, and maintainability of code is important

Thank you for the quick reply!

So would you recommend that once I find the solution on my own, go back and see if there is a more efficient way?

Also, I want to get as much as I can from the course and be a well-rounded coder, but I also want to finish in a reasonable time frame and find a job. I am just fed up with my current career and want to get out soon. Should I focus on finding solutions to the algorithm challenges and getting to more concepts, or should I slow down and find better ways of solving the algorithm?