javascript - 如何在 javascript 文档中指定返回的对象格式
问题描述
我编写了一个处理数据并返回具有特定格式的对象的 javascript 函数。
function processData(itemToProcess){
var information = itemToProcess.extractInformation();
var returnedInfo = {
"firstAttribute": information[0],
"secondAttribute": information[1]
};
return returnedInfo;
}
我想为@returns 字段指定返回对象的格式,但我不知道是否有正确的方法可以做到这一点,或者我是否只需要自己格式化,例如:
@returns : an object with the information formatted as:
- firstAttribute: this attribute is the most important
- secondAttribute: this attribute is the second most important
是否有一种特定的、正确的方法来记录在 Javascript 中返回的对象,或者是编码人员的选择?
谢谢您的帮助。
解决方案
推荐阅读
- python - 将元组转换为字典列表
- database - 如何恢复单个 mongo db 文档的更新
- php - 在 foreach 循环之后在 HTML CSS 中的新页面上打印数据
- python - 选择具有外键的模型的特定实例到另一个模型
- python - Python:打开文件 - 没有这样的文件或目录
- r - match 和 contains 对于 "." 的行为不同。(dplyr)
- c - C程序:实现深度优先搜索(DFS):打印整个访问序列和不同组的断开组件
- flutter - 像这样的 Flutter 自定义列表视图
- python - 在 python 中的 seaborn pairplot 中添加标记时出错
- firebase - Firebase 查询会收取额外的读取费用吗?