Add solution and tests for forEach