我知道我做错了..。
var recipient=[{}];
if (content.moderators.length != 0) {
for (var i = 0; i < content.moderators.length; i++) {
console.log(content.moderators[i])
recipient[i].id=content.moderators[i];
recipient[i].status="unread";
}
}
我收到一个错误:
TypeError:无法设置未定
正如您所看到的,在创建了长度为20的2d数组之后,有一个if语句试图检查数组值是否‘未定义’;但是,不知怎么的,我一直收到错误消息,上面写着"Uncaught TypeError:无法读取未定义的属性'0‘“。那么,是否有一种方法可以避免错误并检查是否有值。
//If there is a more efficiency way to build these loops, then I'll be glad to see it
let map = [];
let savedPoints = [];
let value = 0;
let something = 0;
I am new to react when I trying to fetch JSON data on a table using map function an error is thrown.
TypeError: this.state.merchentOrders.map is not a function 为什么告诉这个.state.merchentOrders.map不是一个函数,当我加载JSON数据时,但我可以把它带到其他标签上,当我试图使用映射函数将数据循环到表时出现问题,如下所示。当我尝试使用map函数获取表上的JSON数据时,我第一次遇到抛出错误的情况。
这是我Drupal网站上的json:
[
{
title: "I believe every human has a finite number of heartbeats. I don't intend to waste any of mine.",
uid: "gestor"
},
{
title: "Man must explore, and this is exploration at its greatest",
uid: "
我创建了一个地图,地图上有一个geoJSON多边形的数据层。我已经成功地使用maps.data.SetStyle设置了填充颜色。现在我想为一组不同的多边形创建一个不同的样式,我可以通过唯一的标识符来识别它。
Google文档使用.getProperty(),但是当我遍历创建数据层的json对象时,就会抛出错误。
职能如下:
map.data.setStyle(function(jsonData){
for(var i = 0; i <= 516; i++){
var SD_NAME =jsonData.features[i].getProperty('pr