Count Nan Values In Array Javascript Iteration