shouldn't this be

```javascript
res[i + k] = data[k]
```
?