Answers for "proper to mixed fraction in javascript"

0

proper to mixed fraction in 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));
Posted by: Guest on August-29-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language