Calculates the aspect ratio (width divided by height).
The height of the element.
The width of the element.
The aspect ratio as a number (width / height).
const ar = getAspectRatio(1080, 1920);console.log(ar); // Output: 1.7777777777777777 (which is 16:9) Copy
const ar = getAspectRatio(1080, 1920);console.log(ar); // Output: 1.7777777777777777 (which is 16:9)
Calculates the aspect ratio (width divided by height).