Ad
  • Custom User Avatar

    thanks for such the dope annotations. really struggled with this but I was able to go through it line by line til I understood the logic behind the parsing.

  • Custom User Avatar

    because 0 is handled differently as per the case studies.
    where 1 and up should return 'num sheep...' 0 should return just a ''.
    you can initialize i as 0 if you want - you'd just have to then handle that case within the loop. if you set i to 1 to begin with, you can do something like

    let i = 1;
    let sheepString = ''

    {your loop of choice here were i is tested against num and all your sheep string building logic is in here}

    and if num = 0 then it can never get into that loop because we alread said i was 1 which is more than 0 and thus not a conditional for the loop.