You are viewing a single comment's thread. Return to all comments →
function catAndMouse( catAPosition , catBPosition , mousePostion ) {
const catAStep = Math.abs(mousePostion - catAPosition); const catBStep = Math.abs( mousePostion - catBPosition );
let difference = catAStep - catBStep;
let result = (difference === 0 )? 'Mouse C':(difference > 0)?'Cat B':'Cat A'; return result }
Seems like cookies are disabled on this browser, please enable them to open this website
Cats and a Mouse
You are viewing a single comment's thread. Return to all comments →
function catAndMouse( catAPosition , catBPosition , mousePostion ) {
const catAStep = Math.abs(mousePostion - catAPosition); const catBStep = Math.abs( mousePostion - catBPosition );
let difference = catAStep - catBStep;
let result = (difference === 0 )? 'Mouse C':(difference > 0)?'Cat B':'Cat A'; return result }