This is the function I am working with:

```
function replaceH1s() {
  $("h1").each(function(){
    h1name = $(this).text();
    stuff = h1name.toLowerCase().replace(' ','-');
    $(this).html('<img src="/assets/image/h1_' + stuff + '.png" alt="' + h1name + '" />');
  })
}

```

I can't figure out for the life of me why this function replaces the first space in h1name string with a hyphen, but not any of the subsequent ones. I tried unescaping and escaping (and then replacing %20 it stumbles upon with hyphens, but that did the same thing). I tried regular expressions for catchall whitespace and that did the same thing. I feel like I am not seeing something super fundamental here.