A slightly cuter way to do the ? and & insertions is to put 'em both inside the for loop:

```
    url.append(i == 0 ? '?' : '&');
```