allElements was reassigned in the keyword for which is wrong this explain why the result is false in the if condition i replace the single equal to sign to double equal to which check both value and datatype else if conditional statement require a round bracket that is to contains some conditions and the code doesn't require the else if conditions so i replace that with else conditional statement