<script> let arr = ["1", "2", "3", "4", "5"] let obj = arr.reduce ((o, v, i) => (o['col_'+v] = arr.slice(0, ++i).join('.'), o), {}); document.write(`<pre>${JSON.stringify(obj, '', 2)}</pre>`) </script>