you are viewing a single comment's thread
view the rest of the comments
[–] 9 points 3 weeks ago (2 children)

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

  • source
  • parent
  • hideshow 4 child comments
  • [–] 6 points 3 weeks ago (1 child)

    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.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 4 points 3 weeks ago

    Not only used for debugging and also if you log a complex object, the way it gets displayed in the console is not always easy/possible to fully inspect. It will get.. truncated for lack of a better word

  • source
  • parent