我想从数据数组中获取所有名称。有没有不用迭代器的方法吗?
const data = [
{name: 'Rushabh', age: 22},
{name: 'Bonny', age: 24}
]
console.log(Object.values(data));
答案 0 :(得分:1)
要仅获取一个属性,则需要直接映射此属性。
(my_env) .. $ python test.py
Using TensorFlow backend.
Traceback (most recent call last):
File "test.py", line 10, in <module>
import keras
File "/home/ ../my_env/lib/python3.5/site-packages/keras/__init__.py", line 3, in <module>
from . import utils
File "/home/ ../my_env/lib/python3.5/site-packages/keras/utils/__init__.py", line 27, in <module>
from .multi_gpu_utils import multi_gpu_model
File "/home/ ../my_env/lib/python3.5/site-packages/keras/utils/multi_gpu_utils.py", line 7, in <module>
from ..layers.merge import concatenate
File "/home/ ../my_env/lib/python3.5/site-packages/keras/layers/__init__.py", line 4, in <module>
from ..engine.base_layer import Layer
File "/home/ ../my_env/lib/python3.5/site-packages/keras/engine/__init__.py", line 8, in <module>
from .training import Model
File "/home/ ../my_env/lib/python3.5/site-packages/keras/engine/training.py", line 21, in <module>
from . import training_arrays
File "/home/../my_env/lib/python3.5/site-packages/keras/engine/training_arrays.py", line 8, in <module>
from scipy.sparse import issparse
ImportError: No module named 'scipy.sparse'
答案 1 :(得分:0)
使用WebApplicationServiceResponseBuilder
并提取@Configuration
属性:
Array.map()
答案 2 :(得分:0)
如果您使用的是JQuery,请执行以下操作:
const data = [
{name: 'Rushabh', age: 22},
{name: 'Bonny', age: 24}
]
var names = $.map( data, function(item, key) { return item.name; } );
// names : ['Rushabh', 'Bonny']