<div></div> <div></div> <div></div> <script> var a = [ [1,2,3], [4,5,6], [7,8,9] ], div = document.querySelectorAll('div'); for(var i=0; i<div.length; i++) { div[i].innerHTML = a[i].join(', '); } </script>