"cannot read property '0' of undefined" when really defined


#1

when the mouse is over the name of the array, the content of the array is shown. but the code doesn’t run because array is “undefined”.
may recursion be the cause?


#2

I believe it should be:

def best(items, *args):

I haven’t tested it but it seems that is proper python.

(I have discovered recently that what the editor knows and what the actual complied code knows aren’t always the same.)


#3

no. items and args are both arrays. i thought about using *, but i need 2 changeable arguments to return 3 values in total (1 with return instruction).
i call the function like this:
"x = best(items, [1, 2, 3, 4])"
or like this:
"parcel = [1, 2, 3, 4]
best(items, parcel)"
but what i see is at the screenshot


#4

Yeah, this sounds like an issue with recursive API protection. I don’t think we will have time to get to the bottom of it any time soon, unfortunately, since we have our hands full with the new beginner-style levels. Please try another approach on Gold Rush for now.