Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getRatio(width, height) {
- const divisor = [2, 3, 5, 7, 9];
- let result;
- do {
- for(let i of divisor) {
- result = false;
- if(!(width % i) && !(height % i)) {
- width = width / i;
- height = height / i;
- result = true;
- break;
- }
- }
- } while(result);
- return {
- width,
- height
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement