Constructors

Methods

  • The static abs function in TypeScript returns the absolute value of a given number.

    Parameters

    • x: number

      The parameter x is a number that represents the value for which you want to calculate the absolute value.

    Returns number

    The absolute value of the input number x is being returned.

    Example

    const result = MathUtils.abs(-7);
    console.log(result); // Output: 7
  • This TypeScript function calculates the hypotenuse of a right triangle given the lengths of its two shorter sides.

    Parameters

    • a: number

      The parameter a represents the length of one side of a right triangle.

    • b: number

      The parameter b represents the length of one of the sides of a right triangle.

    Returns number

    The function calcHypotenuse is returning the square root of the sum of the squares of the two input numbers a and b.

    Example

    const result = MathUtils.calcHypotenuse(7,24);
    console.log(result); // Output: 25
  • The function pow calculates the power of a base number raised to an exponent using the Math.pow method.

    Parameters

    • base: number

      The base parameter represents the base number in a power operation. It is

      /** The static power function in TypeScript calculates the result of raising a base number to a specified exponent.

    • exponent: number

      The exponent parameter in the power function represents the power to which the base number is raised. It determines how many times the base number is multiplied by itself.

    Returns number

    The power function is returning the result of raising the base to the power of exponent using Math.pow method.

    Example

    const result = MathUtils.power(2,2);
    console.log(result); // Output: 4
  • The static sqrt function in TypeScript calculates the square root of a given number.

    Parameters

    • x: number

      The parameter x represents the number for which you want to calculate the square root.

    Returns number

    The square root of the input number x is being returned.

    Example

    const result = MathUtils.sqrt(9);
    console.log(result); // Output: 3

Generated using TypeDoc