Skip to main content

Calculate area.

function areaOfCircle(radius) {
  return Math.PI * Math.pow(radius, 2);
}

function areaOfRectangle(width, height) {
  return width * height;
}

function areaOfSphere(radius) {
  return 4 * Math.PI * (Math.pow(radius, 2));
}

function areaOfTriangle(baseWidth, height) {
  return baseWidth * height / 2;
}