如何从JavaScript中的对象数组中获得不同的值?
var array = [ {"name":"Joe", "age":17}, {"name":"Bob", "age":17}, {"name":"Carl", "age": 35} ]
[17, 35]
var distinct = []for (var i = 0; i < array.length; i++) if (array[i].age not in distinct) distinct.push(array[i].age)
郎朗坤
相关分类