Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
68
rated 0 times [  73] [ 5]  / answers: 1 / hits: 5634  / 9 Years ago, fri, april 24, 2015, 12:00:00

[object Object] is the default string representation of a JavaScript Object.



I would understand if it was just [Object] or [object], but why [object Object]? Why the first word is lowercase and the second one is uppercase? Is it part of JSON or JavaScript?


More From » json

 Answers
4

All objects have a toString method that displays something in the format [object type], where type is the object type.



When called on null you get [object Null] and when called on an object you get the string [object Object] because it's based on the Object constructor (capital O), that's why it says object twice, it's an object of the type Object.



MDN



JSON is a lightweight data-interchange format, and doesn't really have anything to do with JavaScript other than being named JavaScript Object Notation because it's written like a JavaScript object.


[#37667] Thursday, April 23, 2015, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
bryantc

Total Points: 455
Total Questions: 96
Total Answers: 110

Location: San Marino
Member since Thu, Jun 30, 2022
2 Years ago
bryantc questions
Fri, Aug 13, 21, 00:00, 3 Years ago
Tue, Mar 30, 21, 00:00, 3 Years ago
Fri, Jun 5, 20, 00:00, 4 Years ago
Wed, May 27, 20, 00:00, 4 Years ago
;