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

  • MrOzwaldManOP
    link
    fedilink
    arrow-up
    2
    ·
    1 year ago

    Problem with RTFM for me is I always forget what I had read the next day, how do you remember what you read?

    • FooBarrington@lemmy.world
      link
      fedilink
      arrow-up
      2
      ·
      1 year ago

      You have to try and remember the primitive operations available. Say you want to check if any array element matches a predicate. This is a basic operation that’s abstracted for almost every language. If we look for “JS array any”, we’ll get the right function as an MDM result (some). And this works for almost anything. Just try to describe the operation in simple terms and google - you’ll quickly find the function you need, and after some time it will become easier and easier :)

    • boonhet@lemm.ee
      link
      fedilink
      arrow-up
      2
      ·
      1 year ago

      I look up the exact behavior of some basic Kotlin collection lambdas all the time. Does filter return elements with true or false lambda return value? I’ll just Google it instead of relying on my memory.