What does object Object mean JavaScript

0 votes

One of my alerts is giving the following result:

[object Object]
 

What does this mean exactly? Any leads will be helpful!!

Feb 22 in Java by Rahul
• 8,980 points
41 views

1 answer to this question.

0 votes

To answer your question, what this means is that you are alerting an instance of an object. For instance, when alerting the object, toString() is called on the object, and the default implementation returns [object Object].
 

var objA = {}; 
var objB = new Object; 
var objC = {}; 

objC.toString = function () { return "objC" }; 

alert(objA); // [object Object] 
alert(objB); // [object Object] 
alert(objC); // objC

If you want to inspect the object, you should either console.log it, JSON.stringify() it, or enumerate over it's properties and inspect them individually using for in.

answered Feb 22 by Aditya
• 7,280 points

Related Questions In Java

0 votes
1 answer

What does "javascript:void(0)" mean?

The href of the link helps with ...READ MORE

answered Feb 8 in Java by Rahul
• 8,980 points
33 views
0 votes
0 answers

What does "javascript:void(0)" mean?

<a href="javascript:void(0)" id="loginlink">login</a> I've seen such hrefs many ...READ MORE

Apr 14 in Java by Rahul
• 2,540 points
11 views
0 votes
1 answer

What do you mean by object serialization ?

To serialize an object means to convert its state ...READ MORE

answered Jun 14, 2018 in Java by scarlett
• 1,290 points
366 views
0 votes
1 answer

What does NaN mean in Java?

"NaN" stands for "not a number". "Nan" ...READ MORE

answered Jul 12, 2018 in Java by Akrati
• 960 points
693 views
0 votes
1 answer

What is jQuery?

Hey, jQuery is a fast and concise JavaScript ...READ MORE

answered Feb 14, 2020 in JQuery by kartik
• 37,510 points
284 views
0 votes
1 answer

Uncaught TypeError: Cannot read property 'msie' of undefined - jQuery tools

Hello, Use the following script tag in your ...READ MORE

answered Apr 28, 2020 in JQuery by Niroj
• 82,680 points
7,935 views
0 votes
1 answer

Uncaught Error: Bootstrap's JavaScript requires jQuery

Hello @kartik, You have provided wrong order for ...READ MORE

answered Apr 28, 2020 in JQuery by Niroj
• 82,680 points
14,571 views
0 votes
1 answer

How to make Bootstrap popover Appear/Disappear on hover instead of click?

Hello @kartik, Set the trigger option of the popover to hover instead ...READ MORE

answered May 12, 2020 in JQuery by Niroj
• 82,680 points
1,091 views
0 votes
1 answer

What is the JavaScript version of sleep()?

JavaScript has evolved significantly since the time ...READ MORE

answered Feb 18 in Java by Aditya
• 7,280 points
24 views
0 votes
1 answer

How do I redirect with JavaScript?

To redirect to another page by Using ...READ MORE

answered Feb 16 in Java by Aditya
• 7,280 points
24 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP