I don't know if there is a way to create buttons using loops with newly added HTML elements and position those buttons in a grid like we normally do with sprite.
Develop games in your browser. Powerful, performant & highly capable.