首页 > 解决方案 > 如何在 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 中返回的对象,或者是编码人员的选择?

谢谢您的帮助。

标签: javascriptdocumentation

解决方案


推荐阅读