- [{"id":"61188f24396807ba7ca38919a158766de935852e","name":"sen A1 24T","url":"sen-a1-24t","type":"sic","brand":"sen","algor":{"SHA":{"spe":24000000000000,"power":2200}},"specs":{"Release date":"April 2019","Size":"36 x 33 x 24cm","Weight":"4.5 kg","Noise level":"70db","Number of chips":288,"Chip type":"10nm ASIC Chip"}},{"id":"06349be70bd2d5dd98d36b9b8dba0a057500fdac","name":"silicon A10","url":"silicon-a10-ethmaster","type":"sic","brand":"silicon","algor":{"ash":{"spe":480000000,"power":750},"uwei":{"spe":660000000,"power":1500},"dlxau":{"spe":7800000,"power":1020}},"specs":{"Release date":"September 2018","Size":"12.5 x 15.5 x 36 cm","Weight":"5.4 kg","Noise level":"75db","Number of fans":2,"Memory size (VRAM)":"4GB"}}]
复制代码 现在遇到空对象指针,"algor":null,或者"specs":null,下面的代码写入表格就会停止
请教一下遇到空值怎么继续往下走??
var algor = jsonobj[k1]["algor"];
var key2 = Object.keys(algor);
for (var k2 in key2){
var n = key2[k2];
listview2.addNewRow(
{
"algor_id": aid["id"],
"algor": n,
"spe":algor[n]["spe"],
"power":algor[n]["power"]
});
|