Quick actions

cmd+k|ctrl+k

Navigation

Languages

JavaScript - Calculate Aspect Ratio

Snippet info

Language

JavaScript

Visibility

public

Author

mirulumam

Created

2020-05-16T05:03:10Z

Updated

2020-05-16T05:03:10Z

function gcd (w, h) {
    return (h === 0) ? w : gcd (h, w % h);
}
function getRatio(w, h) {
    var g = gcd (w, h);
    console.log(w/g, h/g);
}

getRatio(1080, 2340);
getRatio(1080, 2264);




INFO