SHARE
TWEET

Untitled

a guest Oct 13th, 2019 84 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function getRatio(width, height) {
  2.     const divisor = [2, 3, 5, 7, 9];
  3.  
  4.     let result;
  5.     do {
  6.         for(let i of divisor) {
  7.             result = false;
  8.  
  9.             if(!(width % i) && !(height % i)) {
  10.                     width = width / i;
  11.                     height = height / i;
  12.                     result = true;
  13.                     break;
  14.             }
  15.         }
  16.     } while(result);
  17.  
  18.     return {
  19.         width,
  20.         height
  21.     }
  22. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top