• Waterpumpee@lemmus.org
    link
    fedilink
    English
    arrow-up
    2
    arrow-down
    1
    ·
    3 months ago

    honestly, this is used for debugging. Why not just pass the object as value to the console.log()

    • jaybone@lemmy.zip
      link
      fedilink
      English
      arrow-up
      3
      ·
      3 months ago

      Stringify is used to serialize an object. This is useful if you are going to store the object or transfer the object contents to some other system or component, possibly over a network using a network protocol.

      For debugging, you should use a function like console.log, which depending on the client might even offer an interactive UI to explore the object with structurally aware context. Not just print a giant string, which you get from stringify.