My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more

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.