我如何用伪代码编写这些 jquery 方法?

How do i write these jquery methods in pseudo-code?

我正在努力理解如何用伪代码编写这些内容。

  function makeHeader(label, width){
      //make the header element
      newHeader = $("<th/> <br/>")
        .html(label)
        .addClass("col-sm-"+width)
      return newHeader
  }

我指的是 .html 和 .addClass 部分,我不太明白如何用伪代码来编写它。

写这个:

function makeHeader(label, width){
    newHeader = $("<th/> <br/>").html(label).addClass("col-sm-"+width)
    return newHeader
}

进入伪代码,你可以只看每条语句,看看它在做什么,如果你需要帮助,看看jQuery documentation。但这是完整的伪代码:

Define a function makeHeader, which takes parameters label and width
    Define a variable newHeader, which is HTML markup <th></th><br/>.
        Set the innerHTML property of the element contained in newHeader to the label parameter passed to the function
        Add a class to the element contained in newHeader. The class added will be col-sm- followed by the width parameter passed to the function
    Return the newHeader variable from the function