Python Function Inside Array Initialization Javascript