Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在JavaScript数组中打印特定属性_Javascript_Reactjs_React Native_Expo - Fatal编程技术网

在JavaScript数组中打印特定属性

在JavaScript数组中打印特定属性,javascript,reactjs,react-native,expo,Javascript,Reactjs,React Native,Expo,当我打印它在数组下面打印的变量时,是否有方法从下面的数组打印OwnerId Array [ Place { "lng": -0.0109167, "ownerId": test, "title": "Test", }, Place { "lng": -0.0108539, "ownerId": 234, "t

当我打印它在数组下面打印的变量时,是否有方法从下面的数组打印OwnerId

Array [
  Place {
    "lng": -0.0109167,
    "ownerId": test,
    "title": "Test",
  },
  Place {
    "lng": -0.0108539,
    "ownerId": 234,
    "title": "Server test",
  },
  Place {
    "lng": -0.0108778,
    "ownerId": 234,
    "title": "Tile",
  },]
以下是您想要的:

const a=[{
“液化天然气”:-0.0109167,
“所有者ID”:435,
“标题”:“测试”,
}, {
“液化天然气”:-0.0108539,
“所有者ID”:234,
“标题”:“服务器测试”,
}, {
“液化天然气”:-0.0108778,
“所有者ID”:234,
“标题”:“瓷砖”,
}];

console.log(a.map(x=>x.ownerId))
什么是
Place
?这是
变量.toString()
的输出吗?Place是一个类名:class Place{constructor(lng,ownerId,title){this.lng=lng;this.ownerId=ownerId;this.title=title;}}听起来你想在一行中做点什么,对吗?