我有两个单独的对象数组。如何将一个对象数组中的属性与第二个数组中的另一个属性进行匹配?
我需要将const cars
中的汽车用途与const buyers
中的 searchingUse 进行匹配。
const cars = [
{ model:convertible,
year:2015,
use:sports
},
{ model:wagon,
year:2013,
use:family
}
]
const buyers =[
{ name:John
searchingUse: family,
maxYear: 2014,
maxPrice:15000
},
{ name: Mark
searchingUse: sedan,
maxYear: 2012,
maxPrice:1000
}
]
预期输出将是一个字符串,其中列出与使用
所需的每个买家匹配的所有汽车。非常感谢您的帮助!
谢谢
答案 0 :(得分:0)
我认为您想要这样的东西:
2019-06-07 14:20:46.169 (963 MB) DEBUG [23116| font_manager.findfont]: findfont: Matching :family=DejaVu Sans Mono:style=normal:variant=normal:weight=normal:stretch=normal:size=10.0 to DejaVu Sans Mono (u'/local/lib/python2.7/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSansMono.ttf') with score of 0.050000
2019-06-07 14:20:46.169 (963 MB) DEBUG [23116| font_manager.findfont]: findfont: Matching :family=DejaVu Sans Mono:style=normal:variant=normal:weight=normal:stretch=normal:size=10.0 to DejaVu Sans Mono (u'/local/lib/python2.7/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSansMono.ttf') with score of 0.050000
2019-06-07 14:20:46.272 (963 MB) DEBUG [23116| font_manager.findfont]: findfont: Matching :family=DejaVu Sans Mono:style=normal:variant=normal:weight=normal:stretch=normal:size=5.0 to DejaVu Sans Mono (u'/local/lib/python2.7/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSansMono.ttf') with score of 0.050000
2019-06-07 14:20:46.272 (963 MB) DEBUG [23116| font_manager.findfont]: findfont: Matching :family=DejaVu Sans Mono:style=normal:variant=normal:weight=normal:stretch=normal:size=5.0 to DejaVu Sans Mono (u'/local/lib/python2.7/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSansMono.ttf') with score of 0.050000
2019-06-07 14:20:48.195 (966 MB) DEBUG [23116| font_manager.findfont]: findfont: Matching :family=DejaVu Sans Mono:style=normal:variant=normal:weight=normal:stretch=normal:size=11.0 to DejaVu Sans Mono (u'/local/lib/python2.7/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSansMono.ttf') with score of 0.050000
2019-06-07 14:20:48.195 (966 MB) DEBUG [23116| font_manager.findfont]: findfont: Matching :family=DejaVu Sans Mono:style=normal:variant=normal:weight=normal:stretch=normal:size=11.0 to DejaVu Sans Mono (u'/local/lib/python2.7/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSansMono.ttf') with score of 0.050000
2019-06-07 14:20:49.686 (967 MB) DEBUG [23116| font_manager.findfont]: findfont: Matching :family=DejaVu Sans Mono:style=normal:variant=normal:weight=bold:stretch=normal:size=22.0 to DejaVu Sans Mono (u'/local/lib/python2.7/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSansMono-Bold.ttf') with score of 0.000000
2019-06-07 14:20:49.686 (967 MB) DEBUG [23116| font_manager.findfont]: findfont: Matching :family=DejaVu Sans Mono:style=normal:variant=normal:weight=bold:stretch=normal:size=22.0 to DejaVu Sans Mono (u'/local/lib/python2.7/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSansMono-Bold.ttf') with score of 0.000000