Skip to content
Advertisement

VS code debug – is replacing object values with ellipses. How to show object values in debug?

How can I get the debug console to display the actual values of the sorted object?

The result in the VS Code debug console display as below and are non expandable:

JavaScript

Here is a simple program outputting a sorted object that I have written in VS Code.

JavaScript

Here is the launch.json file:

JavaScript

Advertisement

Answer

Important: This solution only works if you are using Node.js.

If you are using Node.js, you can use the built-in util.inspect() function.

First, you have to import it using require().

JavaScript

Then, you can call the inspect function. You need to pass in your object as a parameter.

JavaScript

Then, you can easily see the object without it being condensed! For more information, see the util.inspect() documentation.


If you are not using Node.js, you can use JSON.stringify(). You can simply use it as so, passing the object as a parameter.

JavaScript

This should allow you to inspect it properly.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement