I'm writing a simple app in vanilla JS. I have an array of strings, and I want to map thru the array and assign the values to innerHTML to the buttons. Can I do it with .map()? As of right now, the most I can get is the last thing assigned to the button's innerHTML ('next >')
Here's my code
var buttons = document.getElementsByTagName("button");
const a = ["click for more", "see more", "details page", "next >"];
a.map((i) => {
buttons.innerHTML = i;
});
<div>
<button>Submit</button>
<button>Submit</button>
<button>Submit</button>
<button>Submit</button>
</div>
<script src="index.js"></script>