I have variable which when i show in alert it shows values 1 but when i assign that value to div then it does not show value on page.\[code\]<html> <head> <script src="http://stackoverflow.com/questions/15742397/jquery-1.6.2.min.js"></script> <script > var ad = ['a', 'b', 'c', 'a', 'd', 'e', 'a']; var con=document.getElementById('data'); var inds = $.map(ad, function(v, i) { //$("data").html(v); return v == 'b' ? i : null; }); //con.innerHTML=inds; alert(inds); // 0,3,6 var avr1=inds; con.innerHTML=avr1; </script> </head> <body> <div id="data"></div> </body></html>\[/code\]