Ad
  • Default User Avatar

    yes thanks for reminding me of .slice
    thank you

  • Default User Avatar

    As Chrono79 said it sounds like you're mutating the input array. If you're using .sort to sort the array from smallest to largest (or vice versa) it will mutate the array you're calling sort on. If you don't want to mutate the input array, you should make a copy of it first using .slice().

  • Custom User Avatar

    If you meant the kata expect the value being 1, you're mutating the input array (99.9% sure).

  • Default User Avatar

    Can someone pls tell me how is it possible for [2, 3, 1].indexOf(2) to return 1 instead of 0 ? If I write this into the browser it returns 0 but when I do this on this kata, this gives me 1.(I use js)