Ad
  • Default User Avatar

    You can store 'ls' in new variable like..

    const ts = ls;

  • Default User Avatar

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

  • Default User Avatar

    My guess is that the main tests have a way of calling back the local variable from the function and reusing it to discourage this approach to the question. Storing the input list in a new variable also seems not to help avoid this. If this is an intentional preventative measure then why is it being used -- what is wrong with trimming values from the list as an approach to solving this kata?

  • Default User Avatar

    Hi. So I ignored the advice not to modify the input list ls and for the main tests it seems that this causes the one test to impact the inputs to the next. If I just make the function print the inputs then I see ls at the start of the function is different to printing ls at the start of the function and then attempting to solve the kata by editing ls later in the function.

    Can someone explain to me how editing the local variable ls within the function can affect the input value of ls in seperate calls of the function?

  • Default User Avatar

    The kata says this is the mountainous Wild West. Hence it can be assumed that such instructions can't be simplified as they may be navigating around obstacles