@pathmaker-digital/pmd-utilities - v2.2.6
    Preparing search index...

    Function getAspectRatio

    • Calculates the aspect ratio (width divided by height).

      Parameters

      • height: number

        The height of the element.

      • width: number

        The width of the element.

      Returns number

      The aspect ratio as a number (width / height).

      const ar = getAspectRatio(1080, 1920);
      console.log(ar); // Output: 1.7777777777777777 (which is 16:9)