[英]loop through returned results node.js
I am getting results returned from my request made to my server.我正在从我向服务器发出的请求中返回结果。 It is returning multiple lines, in which each line is a new entry into the array.它返回多行,其中每一行都是数组中的一个新条目。
So right now I am logging it as:所以现在我将其记录为:
completion.data.choices[0].text
and it is obviously only returning the first one.而且它显然只返回第一个。 But i want it to return all of them.但我希望它返回所有这些。 How would I do this?我该怎么做?
Try this尝试这个
completion.data.choices.forEach(item => {
console.log(item.text)
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.