I am beginner who thought before doing the String Methods section of the course “You know what, let’s test my skills”. And boy my skills were tested. After I completed the challenge my jaw dropped, with the solution.

Had/Have this happened to y’all. Where you make something complicated and found out that there was a simple solution?

Solution

My Code

  • mathemachristian[he]@lemm.ee
    link
    fedilink
    arrow-up
    0
    arrow-down
    1
    ·
    1 year ago

    Oh yeah all the time. Its what taught me to RTFM because in higher languages like JS or Python there typically already is a built-in function to manipulate basic types like arrays and strings, so my goal is usually to exhaust the API reference for a certain object and google around before committing to writing my own for-loop to iterate over an array.

    But props on your code! It is very legible which is always the best place to start at before optimizing. Write legible code and when you’re sure there are no more features you need to add then start optimizing.