使用Visual Studio代码打印完整数组项目

问题描述 投票:0回答:1

enter image description here

我使用Visual Studio Code,并且我想打印所有数组数据,但是它仅显示... more items消息。有什么办法显示这一切吗?我在stackoverflow上搜索它,但找不到解决方案。

我是用户默认的cmd终端,它与Node.js一起运行

visual-studio-code terminal vscode-settings
1个回答
0
投票

您可能正在尝试将所有元素迭代到一个数组中,然后分别打印。参见下面的代码:

arr = [2, 54, 72, ... ] // your big array
arr.forEach(e => console.log(e))

另请参见https://www.geeksforgeeks.org/node-js-foreach-function/,其中采用了上面的代码

© www.soinside.com 2019 - 2024. All rights reserved.