how to give id dynamically in javascript
//Here the delete button gets a unique ID everytime, the ID is the array index of the element.
array.forEach(function (element, index) {
display =
display +
`<tr>
<th scope="row">${index + 1}</th>
<td>${element.first}</td>
<td>${element.second}</td>
<td>${element.third}</td>
<td><button type="button" id="${index}" onclick="deleteNode(this.id)" class="btn btn-danger">Delete</button></td>
</tr>`;
});