If Not Empty Array Javascript Iteration Method