Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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));
Source by www.tutorialspoint.com #
 
PREVIOUS NEXT
Tagged: #proper #mixed #fraction #javascript
ADD COMMENT
Topic
Name
7+4 =