Now that you've got the idea, can you generalise to create a polygon(n) function that will draw a polygon of default side 100?
Have a go before clicking here to reveal my pentagon.

function polygon(n,d=100) {
  var angle=360/n;
  for (var i=0; i<n; i++) { fd(d); rt(angle);}
}
function test() {
 polygon(5);
}
Getting tricky now!

Can you reproduce this pattern using the pentagon? Click here to reveal my answer.

function test() {
  for (var i=0;i<10;i++) {
    polygon(5,200); rt(36)
  }
}