array function two done

works for everything but NaN; if NaN is in the array it returns NaN