<ul>
<li><button name="button1" id="1">ButtonOne</button></li>
<li><button name="button2" id="2">ButtonTwo</button></li>
</ul>
const buttons = [...document.querySelectorAll('button')].reduce((a, c, i) =>
(a['button' + i] = {name: c.name, id: c.id}, a), {});