use reduce instead forEach