我想找到一種方法來過濾我存盤在串列中的API 呼叫結果中的所有每個關鍵字:
const jList = [];
result.data.results.forEach((element) => {
jList.push(element)
});
我的 api url 呼叫但它沒有我想要的引數值:
h..s://api/...&results_per_page=20&what="lead-manager"&content-type=application/json"
...但我看到它們直接出現在API 呼叫結果中,所以我嘗試這個來獲取每個引數,例如:title,company不幸的是它不起作用
for (element of jobList) {
title: { result.data.results.[].title },
created: { result.data.results.[].created },
description: { result.data.results.[].description },
company: { result.data.results.[].company }
}
console.log(title)
我如何從元素中獲取每個引數?
所以請幫助我,謝謝
uj5u.com熱心網友回復:
你試過用地圖嗎?
result.data.results.map((item) =>{ console.log(item.title) })
uj5u.com熱心網友回復:
result.data.results.map((item) =>{
let info = {
title: item.title
description: item.description
}})
我不完全了解您想要實作的目標,但這就是您想要的嗎?
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/444796.html
標籤:javascript 节点.js api 数组列表
