如何從數組中的所有對象中獲得僅作為特定值的選擇?這是一個示例數組:var array = [{ a: 1, b: 2,},{ a: 3, b: 4,},{ a: 5, b: 6,}]后來詢問者是這樣的:inquirer.prompt({ name: "test", type: "list", message: "Example Question", choices: [{array.b}]})我期望的結果如下作為列表問題的詢問者選項:[2,4,6]
有沒有辦法使用對象數組來填充查詢器中的選擇?
開心每一天1111
2023-11-11 20:57:21