Array item iteration using for loop

Another solution could be to use the instanceOf operator