Search
 
SCRIPT & CODE EXAMPLE
 

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));
Comment

PREVIOUS NEXT
Code Example
Javascript :: js knex migration 
Javascript :: updating json object in mysql database 
Javascript :: search an array with regex javascript indexOf 
Javascript :: javascript number if .00 truncate 
Javascript :: alpine js 
Javascript :: JavaScript POSITIVE_INFINITY 
Javascript :: react chart js 2 api data 
Javascript :: 1 day ago javascript 
Javascript :: how to access data in json format using asp.net c# 
Javascript :: how to add icons in angular 
Javascript :: for loop -2 js 
Javascript :: Error: ENOENT: no such file or directory, lstat ode_modules@react-navigationcoresrcgetStateFromPath.tsx 
Javascript :: node cache 
Javascript :: material ui react card 
Javascript :: react-google-login 
Javascript :: reactjs lifecycle class components 
Javascript :: jquery effect methods 
Javascript :: substr method 
Javascript :: jquery get all data attributes values 
Javascript :: element.js 
Javascript :: how to connect mongodb with next js 
Javascript :: array in javascript 
Javascript :: Aug 25 2020 00:00:00 GMT+0530 
Javascript :: send audio with socket io node js 
Javascript :: scroll up 
Javascript :: react useEffect life cycle 
Javascript :: d3js.org 
Javascript :: how to create a javascript hello world program with node.js 
Javascript :: v-on shorthand 
Javascript :: alternative way to handle React routes in a separate file 
ADD CONTENT
Topic
Content
Source link
Name
9+2 =