Itrate array in jquery

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
<script>
$(document).ready(function()
{
var arr = [2,3,4,5,6,7,8,9];
var elements = '';
arr.forEach(function(item){
elements = elements +" "+ item;
});
$('#arr').text(elements);
});
</script>
<div id="arr"></div>

Share This: