-
-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathaspectRatio.js
More file actions
9 lines (6 loc) · 695 Bytes
/
aspectRatio.js
File metadata and controls
9 lines (6 loc) · 695 Bytes
1
2
3
4
5
6
7
8
9
/*
The aspect ratio of an image describes the proportional relationship between its width and its height. Most video shown on the internet uses a 16:9 aspect ratio, which means that for every pixel in the Y, there are roughly 1.77 pixels in the X (where 1.77 ~= 16/9). As an example, 1080p video with an aspect ratio of 16:9 would have an X resolution of 1920, however 1080p video with an aspect ratio of 4:3 would have an X resolution of 1440.
Write a function that accepts arbitrary X and Y resolutions and converts them into resolutions with a 16:9 aspect ratio that maintain equal height. Round your answers up to the nearest integer.
*/
//Answer//
let = (x,y)=> [Math.ceil(y*(16/9)),y]