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.

Hassle-free blogging platform that developers and teams love.
  • Docs by Hashnode
    New
  • Blogs
  • AI Markdown Editor
  • GraphQL APIs
  • Open source Starter-kit

© Hashnode 2024 — LinearBytes Inc.

Privacy PolicyTermsCode of Conduct