I am new in JavaScript, I want to search the number of id=heading and append unique class name to the existing class. 

I have tried to do this using JavaScript but able to add only to the first heading only. 
Please refer the code-pen: <https://codepen.io/restar312/pen/EqWOyV>

```
var check_div = document.getElementsByTagName('div');
var numheading = 0;
for (var i = 0; i < check_div.length; i++) {
  if (check_div[i].id.indexOf('heading') != -1)
    numheading++;
  console.log(numheading);
  var d = document.getElementById("heading");
  d.className += numheading;
}

```

Expected class name should be class=First\_heading1...class=First\_heading2...class=First\_heading3