gpt4 book ai didi

javascript - Firebug 控制台缩短记录数组中的字符串?

转载 作者:行者123 更新时间:2023-12-03 13:10:28 25 4
gpt4 key购买 nike

我有一个自定义日志记录功能来记录到 firebug 控制台,如下所示:

// the name here is just for fun
function ninjaConsoleLog() {
var slicer = Array.prototype.slice;
var args = slicer.call(arguments);
console.log(args);
}

它的工作方式与我想要的完全一样......除了如果我的字符串值在数组中超过大约 7 个单词,firebug 控制台会隐藏除了前两个单词和最后两个单词之外的字符串值. (大约)

例子:

ninjaConsoleLog("This is a longish string, like the energizer bunny, it just keeps going and going and going.");

上述函数调用导致以下输出到 firebug 控制台:

["This is a longish strin...going and going."]

这很好,除了有时控制台缩写的字符串部分包含重要数据。

首先,为什么会发生这种情况?

其次,使用我当前的日志记录功能,我是否可以强制控制台输出数组中每个项目的完整字符串值?或者在查看控制台输出时只查看整个字符串?

或者这是不可能的?

谢谢!!

最佳答案

尝试将其更改为 console.dir(args) 而不是 console.log(args)

此外,您应该能够单击 Firebug 控制台中的值以将它们扩展为完整值框符号中会有一个加号,或者当您将鼠标悬停在该值上时它会变成下划线,这意味着单击它会扩展到其完整值

关于javascript - Firebug 控制台缩短记录数组中的字符串?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3359273/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com