Variable areaConst

area: {
    circle: ((r) => number);
    ellipse: ((a, b) => number);
    parallelogram: ((b, h) => number);
    rectangle: ((a, b) => number);
    square: ((a) => number);
    trapezoid: ((a, b, h) => number);
    triangle: ((b, h) => number);
} = ...

Type declaration

  • circle: ((r) => number)
      • (r): number
      • Area of a circle.

        Parameters

        • r: number

          The radius.

        Returns number

        Returns the area.

        Since

        0.7.0

        Example

        area.circle(1)
        // => 3.14159
  • ellipse: ((a, b) => number)
      • (a, b): number
      • Area of an ellipse.

        Parameters

        • a: number

          The major radius.

        • b: number

          The minor radius.

        Returns number

        Returns the area.

        Since

        0.7.0

        Example

        area.ellipse(1, 2)
        // => 6.28319
  • parallelogram: ((b, h) => number)
      • (b, h): number
      • Area of a parallelogram.

        Parameters

        • b: number
        • h: number

        Returns number

        Returns the area.

        Since

        0.7.0

        Example

        area.parallelogram(3, 2)
        // => 6
  • rectangle: ((a, b) => number)
      • (a, b): number
      • Area of a rectangle.

        Parameters

        • a: number
        • b: number

        Returns number

        Returns the area.

        Since

        0.7.0

        Example

        area.rectangle(2, 3)
        // => 6
  • square: ((a) => number)
      • (a): number
      • Area of a square.

        Parameters

        • a: number

        Returns number

        Returns the area.

        Since

        0.7.0

        Example

        area.square(2)
        // => 4
  • trapezoid: ((a, b, h) => number)
      • (a, b, h): number
      • Area of a trapezoid.

        Parameters

        • a: number
        • b: number
        • h: number

        Returns number

        Returns the area.

        Since

        0.7.0

        Example

        area.trapezoid(3, 2, 2)
        // => 5
  • triangle: ((b, h) => number)
      • (b, h): number
      • Area of a triangle.

        Parameters

        • b: number
        • h: number

        Returns number

        Returns the area.

        Since

        0.7.0

        Example

        area.triangle(1, 2)
        // => 1