Is there a way to copy an array in the JavaScript console with every element being on the same line?

huangapple go评论64阅读模式
英文:

Is there a way to copy an array in the JavaScript console with every element being on the same line?

问题

我正在尝试通过JavaScript控制台复制一个包含100多个项目的大数组到剪贴板,我已经能够做到,但我遇到的问题是数组元素出现在不同的行上,就像这样:

[1,
2,
3,
4,
5, ...];

我想要的是将数组复制到剪贴板上的一行中,就像这样:

[1, 2, 3, 4, 5...];
英文:

I am trying to copy a large array of over 100 items to my clipboard through the JavaScript console, which I am able to do, but the problem I am having is that the elements appear on different lines like this:

[1,
2,
3,
4,
5, ...];

What I want is to copy the array to my clipboard in one line like this:

[1, 2, 3, 4, 5...];

答案1

得分: 1

使用JSON.stringify(array)简单地打印出数组的字符串版本。

英文:

Simply print the string version of your array with JSON.stringify(array)

huangapple
  • 本文由 发表于 2023年6月16日 04:28:43
  • 转载请务必保留本文链接:https://go.coder-hub.com/76485304.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定