Fração adequada à mista em JavaScript
const arr = [22, 46];
const properToMixed = arr => {
const quotient = Math.floor(arr[0] / arr[1]);
const remainder = arr[0] % arr[1];
if(remainder === 0){
return [quotient];
}else{
return [quotient, remainder, arr[1]];
};
};
console.log(properToMixed(arr));
Better Butterfly