Ad
  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    No, it does not. In the newest browsers versions, radix is set to 10 by default. See: https://stackoverflow.com/a/58311034/17799125

  • Custom User Avatar
  • Custom User Avatar
  • Default User Avatar
  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    i was close to this haha...good work!

  • Custom User Avatar
  • Default User Avatar

    Can think of it like this:

    • first, we set up way to handle all undefined cases

    • we'll be able to check and handle all other cases by combining the loop and if conditional

    • we can use guarded clause if that'll run only if the for loop doesn't return earlier

    • we put return undefined at the end of the code block

    • we know we need to return the value that is sequenced after the item

    • we can combine loop and conditional variable for COMBINED SET UP

    • when loop finds what it needs to find, we can tell it to modify variable outside of loop body

    • which means the next iteration runs

    • and that iteration - it contains the next value, which is what we're looking for

    • and then and there - we can use the changed variable outside of the loop function

    • and when that variable it's true and only then

    • we can just return that value, as it's the value right after the previous value

    • and the previous value was a match, equal to item

    • so if we return the value from the iteration that is right after that iteration that found the match

    • that'll always be the value we're looking for, given the problem specification

    • we need a loop that can iterate over any iterable, not just array

    • for...of... does that

    • now, in each iteration, we're getting the value

    • we check it against the item

    • if it is the item

    1. Understanding what for...of...loop is & what a guarded clause (if) statement is,
    2. Understanding how a SET UP can be achieved, by COMBINING a loop, and a conditional variable
    3. Understanding how RETURN STATEMENT can COMBINED with the above SET UP,
    4. Using these 3 understandings to create a LOOP that CHECKS what it needs to check, MODIFIES the VARIABLE when it needs to, and USES THE SET UP to RETURN when it's time and does NOTHING if no check passes, swhich is caught by the last statement, the guarded clause if

    It's probably best to go at these one at a time, and really get each item more deeply in a successive progression.

    If you didn't know any of this - and never saw the solution before - what would make solving it that way a 100x easier, is more or less:

    1. Knowing that for...of... exists (study your toolset, study knowing a lot of vocabulary and phrasing, study being proficient in the tongue you're using)
    2. Understanding what for...of... is in concept
    3. Understanding in general that different pieces of a language can be combined together in some useful fashion
    4. Understanding more specifically that conditional variable based on if, can be combined with a loop, in some useful ways
    5. Understanding how to do it, being well-practiced in combining such distinct features of a language, some solid and varied reps, deliberate practice and training at specifically just that small combination, one at a time
    6. Understanding what the problem is, in exact terms
    7. Being able to look for windows of opportunity in a problem, for openings that can be used to accomplish what we want to accomplish out of it
    8. Combining that ability with the toolset we learn, so we can be better and better at finding what we need to find because we have internalized the items that can match what we seek for
    9. Now, that's a lot - with practice, many points become fewer, connected points, which ultimately become one chunk of learned concepts and internalized training relating to the scope of that chunk and its connection to other chunks
  • Custom User Avatar

    welp i learn't something today.

  • Custom User Avatar
  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    What is this form of comparison called, im trying to learn it but i am not sure what it is named.

  • Loading more items...