Skip to content
DevMeme
5008 of 7590
Languages Post #5477 · source on Telegram

JavaScript objects getting the full-name treatment from an angry console

Description

On a stark white background the meme opens with the caption “When mom calls you by your full name” in bold black letters. Centered below, a single oversized speech bubble calmly says “[object Object]”. Underneath, three tiny speech bubbles each shout the word “Fuck”, and directly beneath those bubbles are the literal characters “[]”, “{}”, and “1”, symbolising an empty array, an empty object, and the number one respectively. The visual gag plays on JavaScript’s default toString behaviour: complex objects reveal their verbose ‘legal name’ while primitives and simple structures stay terse - just like the difference between Mom’s full-name scolding and everyday chatter. Seasoned devs will recognise the debugging pain of a rogue console.log that forgot its JSON.stringify call and flooded logs with “[object Object]”

Comments

13
Anonymous ★ Top Pick Nothing sobers up a code review faster than a console.log screaming “[object Object]” - the runtime equivalent of your mom dropping your first, middle *and* last names
  1. Anonymous ★ Top Pick

    Nothing sobers up a code review faster than a console.log screaming “[object Object]” - the runtime equivalent of your mom dropping your first, middle *and* last names

  2. Anonymous

    Twenty years in, and I still instinctively check if I accidentally stringified an object in production whenever monitoring alerts use my full name

  3. Anonymous

    Every senior engineer has spent at least one 3 AM debugging session staring at '[object Object]' in production logs, wondering if they should finally learn to properly serialize their data structures or just accept that JavaScript's toString() implementation is the universe's way of teaching humility. The real panic isn't when mom uses your full name - it's when your monitoring dashboard shows '[object Object]' in the error message field and you realize your logging middleware has been silently failing for three months

  4. Anonymous

    In JavaScript, when mom uses your full name, ToPrimitive('string') fires and you become '[object Object]' - still a clearer contract than half the legacy APIs I maintain

  5. Anonymous

    Production tip: when your logs say “[object Object]”, that’s not a username - it’s ToPrimitive scolding you for using + instead of JSON.stringify

  6. Anonymous

    Hearing your full name from mom: the JS toString() of childhood sins - pure, unparseable [object Terror]

  7. @Araalith 2y

    Object.prototype.toString = function() { return JSON.stringify(this); }; Is it so hard?

  8. @NaNmber 2y

    What's the deal with 1?

    1. @Araalith 2y

      "Number" is a wrapper object. "number" - is a primitive.

      1. @NaNmber 2y

        what's the relation between 1 and [object Object]?

        1. @callofvoid0 2y

          Number has an overrided toString method

        2. @Araalith 2y

          > const a = 1; a.constructor.name 'Number' > Object.getPrototypeOf(a.constructor) {} > const b = []; b.constructor.name; 'Array' > Object.getPrototypeOf(b.constructor) {} They all are objects. But tbh, I don't think that the picture statement is true.

  9. @kandiesky 2y

    Everything is an object if you're ECMAScript enough

Use J and K for navigation