将变量分配给一个非常大的数组使其未定义
assigning a variable to a very big array make it undefined
我使用了一些端点来获取所有加密硬币的简单信息,这个列表非常大
2个清晰的例子说明问题
// example one
var arrWithSmallLength = [ {
name: 'Bitcoin',
symbol: 'btc',
id: 'bitcoin',
image: 'bitcoin_logo_url'
},.....];
// length of arrWithSmallLength is less than 1000
console.log(arrWithSmallLength); // it prints the array normally
// example two
var arrWithBigLength = [ {
name: 'Bitcoin',
symbol: 'btc',
id: 'bitcoin',
image: 'bitcoin_logo_url'
},.....];
// length of arrWithBigLength is more than than 8000
console.log(arrWithBigLength); // it prints undefined
The arrWithBigLength rendered in VS Code in more than 78500 lines
更新
在此 link 中找到数据负载:https://drive.google.com/file/d/1FIbMoLbtzRm7LqMaPZnE3EAL26sj4VOo/view
在您的 json 文件中,查找值 'Staked yAxis'。在这个条目之后你会发现
}
]
[
{
此处您第二次重复数据,导致 json 定义错误。删除此行之后的双打,您的数据就可以工作了。第 39273 行之后的所有内容都不应该存在(除了结尾 }
.
我使用了一些端点来获取所有加密硬币的简单信息,这个列表非常大
2个清晰的例子说明问题
// example one
var arrWithSmallLength = [ {
name: 'Bitcoin',
symbol: 'btc',
id: 'bitcoin',
image: 'bitcoin_logo_url'
},.....];
// length of arrWithSmallLength is less than 1000
console.log(arrWithSmallLength); // it prints the array normally
// example two
var arrWithBigLength = [ {
name: 'Bitcoin',
symbol: 'btc',
id: 'bitcoin',
image: 'bitcoin_logo_url'
},.....];
// length of arrWithBigLength is more than than 8000
console.log(arrWithBigLength); // it prints undefined
The arrWithBigLength rendered in VS Code in more than 78500 lines
更新
在此 link 中找到数据负载:https://drive.google.com/file/d/1FIbMoLbtzRm7LqMaPZnE3EAL26sj4VOo/view
在您的 json 文件中,查找值 'Staked yAxis'。在这个条目之后你会发现
}
]
[
{
此处您第二次重复数据,导致 json 定义错误。删除此行之后的双打,您的数据就可以工作了。第 39273 行之后的所有内容都不应该存在(除了结尾 }
.