Advertisement
Guest User

Untitled

a guest
Oct 13th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement