Sign in
Log inSign up

Array Confusion In javascript

Default profile photo
Anonymous
·Apr 10, 2018
var a =[1,2,3]
alert(a);  

output is 1,2,3
var b = [{h:"rrr"}];
alert(b);
output is object Object

In second case h:"rrr" should be alerted but it is displaying object Object ,unable to track what is going under the hood because 1 st example is working fine.