📌  相关文章
📜  名称的格式字符串 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:04:22.428000             🧑  作者: Mango

代码示例1
function list(names) {
  var xs = names.map((p) => p.name);
  var x = xs.pop();
  return xs.length ? xs.join(", ") + " & " + x : x || "";
}

// Example:
// list([ {name: 'Bart'}, {name: 'Lisa'}, {name: 'Maggie'} ])
// returns 'Bart, Lisa & Maggie'