Critique my solution compared to instructor's solution?

I just solved the “Is Valid Name” problem for the Array Methods & Enumerables section of Full Stack Online - Intro to Programming.

I’d love feedback on the tradeoffs between how I solved the problem and how the instructor solved the problem.

My solution is on the left, and the instructor’s solution on the right:


I just completed the hashes section so I’m not that far ahead of you and I remember also coming up with a different code that worked to get the solution. Ultimately I discarded mine because I felt it wasn’t as good as their solution. It was dynamic enough.

Yours however seems well written to me. The only thing “wrong” that i would be able to see is if the problem asked you to use a method to solve the problem but I don’t remember if this one did or not. (Although I do remember it was what the instruction/other problems were focused around).

I look forward to hearing someone else’s thoughts.

@Mr335 thanks for the response :grinning:

Yeah, I think your point is accurate—my solution is “wrong” in that it doesn’t use the curriculum that was previously presented. The method works, but it’s not the way the instructor intends for the solution to be solved.