JavaScript - Calculate Aspect Ratio
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
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);