简体   繁体   中英

How do I write this method in javascript?

The static pointsToPolygon method must take as its parameter an array of Point s, pts. The method must create a new Polygon object that is defined as having the Point s in pts as its points. Your method must return a reference to this new Polygon object.

function funName(...restParam){
  return yourPol;
}

The rest operator lets you pass unlimited number of arguments as an array.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM