var txt = ""; var numbers = [45, 4, 9, 16, 25]; numbers.forEach(function(value, index, array) { txt = txt + value + "<br>"; });