Python Nested Function Variable Javascript Array Find