inplace array update via forEach