change the judege Function for to forEach