Integer Array Javascript Function Practice