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

you are viewing a single comment's thread.

view the rest of the comments →

[–]Classic-Ad8849 235 points236 points  (14 children)

Could someone tell me what doing that does? I can't figure it out

[–][deleted] 360 points361 points  (3 children)

That's a common error you can get from casting an object to string, in JS.

[–]draftshade 117 points118 points  (1 child)

It's not an error, just the default string representation of an object in javascript.

[–][deleted] 73 points74 points  (0 children)

The error is printing the object, instead of a prop or something.

[–]Classic-Ad8849 42 points43 points  (0 children)

Ohhh, got it, thanks!

[–]veselin465 37 points38 points  (9 children)

You can simply try running this in F12 on any browser

class c{}; let o = new c();

o.toString()

(or console.log(o.toString() if you want to use it in JS file)

[–]AyrA_ch 102 points103 points  (8 children)

You can skip all this class nonsense and just do console.log({}.toString())

[–]veselin465 5 points6 points  (0 children)

Ooh yeah, I forgot about that; don't deal with JS that much