title: JavaScript get h1 elements in HTML document and update unique IDs
body: <p>I have a legacy html document containing h1 elements which don't have ids.
  What I would like to achieve is to be able, using JavaScript, to get all h1(s) and then add to each a unique ID.</p>
  
  <p>I have searched but could not find a solution that works.</p>