【问题标题】:How do I write this method in javascript?如何在 javascript 中编写此方法?
【发布时间】:2021-10-28 23:47:59
【问题描述】:

静态 pointsToPolygon 方法必须将 Point s, pts 的数组作为其参数。该方法必须创建一个新的 Polygon 对象,该对象被定义为将 pts 中的 Point s 作为其点。您的方法必须返回对这个新 Polygon 对象的引用。

【问题讨论】:

  • 请提供足够的代码,以便其他人更好地理解或重现问题。

标签: javascript polygon


【解决方案1】:
function funName(...restParam){
  return yourPol;
}

rest operator 允许您将无限数量的参数作为数组传递。

【讨论】:

    猜你喜欢
    • 2014-04-17
    • 2022-09-29
    • 2012-03-10
    • 2011-05-03
    • 1970-01-01
    • 1970-01-01
    • 2022-01-15
    • 1970-01-01
    相关资源
    最近更新 更多