我使用数组作为对象的关联数组,其中键是数据库中对象的ID号。安静自然- it是大数字-所以这意味着它的数组长度为10^4,只有20个元素作为有效的实际对象。我需要一种将关联数组转换为JSON的方法,丢弃未定义的条目。编辑:我的数组是什么样子的示例: var myAssociativeArray =未定义,未定义,未定义.,未定义,.又一个..。
我试过了 > Array(3)> // and this joins up all the nothings'--'> Array(3).map((x) => 'a')> // map doesn't work with the array of empty items! 我想我会得到和这个一样的结果 > [und