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, 2022 in Java by Rahul
• 9,680 points
2,519 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, 2022 by Aditya
• 7,680 points

Related Questions In Java

0 votes
0 answers

What does [object Object] mean? (JavaScript)

One of my notifications had the follo ...READ MORE

Sep 22, 2022 in Java by Nicholas
• 7,760 points
500 views
0 votes
1 answer

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

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

answered Feb 8, 2022 in Java by Rahul
• 9,680 points
933 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, 2022 in Java by Rahul
• 3,380 points
609 views
0 votes
0 answers

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

<a href="javascript:void(0)" id="loginlink">login</a> ...READ MORE

Sep 20, 2022 in Java by Nicholas
• 7,760 points
560 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,520 points
1,315 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,840 points
15,710 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,840 points
23,295 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,840 points
3,311 views
0 votes
1 answer

What is the JavaScript version of sleep()?

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

answered Feb 18, 2022 in Java by Aditya
• 7,680 points
454 views
0 votes
1 answer

How do I redirect with JavaScript?

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

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