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
• 9,680 points
637 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,660 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 in Java by Nicholas
• 7,120 points
71 views
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
• 9,680 points
121 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
• 3,380 points
64 views
0 votes
0 answers

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

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

Sep 20 in Java by Nicholas
• 7,120 points
71 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
416 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,800 points
10,071 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,800 points
17,562 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,800 points
1,674 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,660 points
83 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,660 points
70 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