or perhaps more clearly (nod to Crockford):

```
string = string + (rep || ch);
```