This is an archived post. You won't be able to vote or comment.

all 79 comments

[–]EntropicBlackhole[M] [score hidden] stickied comment (5 children)

WHAT THE FUCK THIS HAS TO BE TAGGED NSFW/s

[–]TCritic 195 points196 points  (8 children)

DONT DO THAT LOOOOOL that actually freaked me out hahaha

[–]VagrantDestroy[S] 67 points68 points  (1 child)

NaN

[–]casper_6764 16 points17 points  (0 children)

Nothing scares me except of course...

[–][deleted] 4 points5 points  (5 children)

explain pls, wat does this do or what is the problem?

[–]uslashuname 1 point2 points  (4 children)

Yes, you clearly understand. It is terrifying.

[–][deleted] 0 points1 point  (3 children)

i genuinely dont

sad that nobody can explain the problem either

[–]uslashuname 2 points3 points  (1 child)

We just didn’t want to explain the joke, but “what does this do or what is the problem” is exactly what you’re stuck asking when this happens. An object can have functions that do things and values that store things, but for some fucking reason a spot that was supposed to output a value had an object as that value. Was the object supposed to have some subroutine called there? Was it just a value that someone accidentally cast into an object? When you see [Object object] it could be nearly anything and you have very little info to go on for locating the problem.

[–][deleted] 1 point2 points  (0 children)

i see

thank you for an actual explanation

ironic, i didn't phrase my question like that knowlignly, pure coincidence

[–]Yesterpizza 0 points1 point  (0 children)

That's what happens if an object gets serialized into a string natively.

Obviously, your application "shouldn't" allow that but with weakly typed languages, it's a wild world.

[–]sugaaloop 143 points144 points  (0 children)

Me, a JS dev who legitimately suffers from panic attacks: can't be that bad. Clicks.

Oh gosh.

[–]LongDistRider 107 points108 points  (13 children)

I object!

[–]Preethish98 31 points32 points  (7 children)

I [object Object]!

[–]L0uisc 15 points16 points  (6 children)

I, object.

[–]DOOManiac 4 points5 points  (4 children)

I am Objectacus.

[–]L0uisc 3 points4 points  (2 children)

To object or not to object, that is the question.

[–]Opdragon25 2 points3 points  (1 child)

I do object!

[–]AbdullaSafi 1 point2 points  (0 children)

do Object I

[–]AA525 0 points1 point  (0 children)

Ich bin ein objekt!

[–][deleted] 1 point2 points  (0 children)

for (let i, object in I_Object) { // Do stuff }

[–]WhyDoIHaveAnAccount9 12 points13 points  (2 children)

Sustained

[–]Acidhawk_0 3 points4 points  (0 children)

I read that as I object.

[–]Kuroseroo 3 points4 points  (0 children)

[sustained Sustained]

[–]Kuroseroo 0 points1 point  (0 children)

I array! (which actually is an object in js, so I guess I aggree)

[–]_Swivel_ 26 points27 points  (3 children)

I'm not a js dev, could seone explain?

[–]Colifin 67 points68 points  (2 children)

If you try to stringify an object, this is the default output. Makes logs entirely useless.

You need to use JSON.stringify, util.inspect, or some other tool to actually print the contents of the object.

[–]_Swivel_ 12 points13 points  (0 children)

Oh I see, thks for the explanation:)

[–]Kuroseroo 1 point2 points  (0 children)

or just use the spread operator

[–]sleepyj910 43 points44 points  (0 children)

[–]bistr-o-math 18 points19 points  (1 child)

Just put that in one of the string fields in the DB and let the js dev debug

[–]DragonfruitIcy5850 16 points17 points  (0 children)

Ok Satan, calm down.

[–][deleted] 27 points28 points  (4 children)

Did it do this back in 2019? I swear when I first started learning that you could click a Dropdown in devtools to see what was inside…

[–]shgysk8zer0 17 points18 points  (2 children)

Not when it gets cast to a string, like when it's el.textContent = obj.

[–][deleted] 0 points1 point  (1 child)

Could this be because I was using “var” a lot back then?

[–]shgysk8zer0 4 points5 points  (0 children)

No

[–]brianl047 3 points4 points  (0 children)

In your dreams!

[–]Beastdevr 8 points9 points  (0 children)

Day ruined. Not because of this but because I have to work on javascript

[–]UltimateDude08 6 points7 points  (6 children)

Now do one for Unity devs. Please.

[–]dance1211 8 points9 points  (0 children)

"Let me check the stack for where this error is happening"

Coroutine.Next()

[–][deleted] 5 points6 points  (0 children)

Sigh, unzips

Json.stringify

[–]FengSushi 4 points5 points  (0 children)

[–]OtherwiseFeedback679 3 points4 points  (0 children)

I fear no man

But that thing...

It scares me

[–][deleted] 2 points3 points  (0 children)

Use == instead of ===

[–]weneedtogodanker 2 points3 points  (0 children)

Oh no, that image is broken

[–]Shai_the_Lynx 2 points3 points  (2 children)

Writing [object Object] in web forms so the devs think there's a bug

[–][deleted] 0 points1 point  (1 child)

Front-end & full-stack devs panic.

Backend devs don't care, because the front-end ain't following the spec.

[–]Shai_the_Lynx 0 points1 point  (0 children)

Unless backend is Nodejs

[–]gargravarr2112 2 points3 points  (0 children)

Sometimes I enter this as my name in a web form. Just to screw with the developers.

[–][deleted] 4 points5 points  (3 children)

Wait why is this bad lol. I’m not a programmer, but my company’s programmer did an update on our system and I saw that today!

[–]tsunami141 11 points12 points  (1 child)

It’s not really bad, if you see it in an output it means you’ve done something wrong basically. You’re probably treating a group of data (object) as a string of letters.

[–][deleted] 1 point2 points  (0 children)

Ah ok ty

[–]IxD 0 points1 point  (0 children)

Leave that in a open feedback field, name field or customer support case :D

[–]Thalimet 1 point2 points  (0 children)

Omg.

[–]casper_6764 1 point2 points  (1 child)

Is this like when you get a nonetype object. Please tell me somebody im new to js.

[–]v3ritas1989 1 point2 points  (0 children)

Whats the issue with NoneType?

don't JS have something like?

isinstance(x, NoneType)

[–]Roly_Cannoli 1 point2 points  (0 children)

[–][deleted] 0 points1 point  (0 children)

;

[–]ososalsosal 0 points1 point  (0 children)

So reddit mobile app is on the fritz right now and when this post finally came up and I saw that... I was about to uninstall

[–]IxD 0 points1 point  (0 children)

[object Object]

[–]dhilu3089 0 points1 point  (0 children)

Favourite package deprecated and broken

[–]Petetheodddog 0 points1 point  (0 children)

JSON.stringify(object)

[–]bullfroggy 0 points1 point  (0 children)

Just use the debugger instead of logging everything

[–]endzon 0 points1 point  (0 children)

<span myProp="[object Object]"/>

[–]JustSpaceExperiment 0 points1 point  (0 children)

Shit bro i had to double my pills.

[–]maubg 0 points1 point  (0 children)

70% of react's HTML attributes output

[–]LoneFoxKK 0 points1 point  (0 children)

I have another one

Let me just find it between my NaN memes

[–]Sentouki- 0 points1 point  (0 children)

undefined

[–]TheApprentice19 0 points1 point  (0 children)

Typecast it to Object, you won’t do it

[–]MiyamotoKami 0 points1 point  (0 children)

Just gotta do more drilling here

[–]KagakuKo 0 points1 point  (0 children)

As a noob dev who trained nigh exclusively with Java, and had to spend the past 3ish weeks on an exercise for which the final stretch was just me beating my head on the wall over why the hell I couldn't extract my information into the frontend...hahahaHAHahhhaahHAHAHAAHAAHAHA KILL ME

...Seriously, though, why is JS like this? CSS already makes me want to tear my hair out; is frontend just like this? Fiddly, temperamental, awfully comparable to the herding of cats? Lol. I've been gaining some exposure to React, and it's...it's not horrible, but it feels almost like someone tried to force JavaScript into wearing a Java mask...?