Python Create Function Inside Function Js Mdn Array Find