Wow! This problem is kind of tricky. If you're ready to put your thinking cap on, brace yourself and good luck! Otherwise, you can skip it for now and return any time later
Change and implement the perimeter() function to calculate the perimeter of a polygon with 3 or 4 vertices, represented by X and Y coordinates. Vertices are passed sequentially.
You can use the Math.hypot(..., ...)function to calculate the length of the segment using the Pythagorean theorem. Math.hypot(x,y) returns
Tip: Don't forget that a default value of an argument can be another argument.