We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
/** * x - cat a * y - cat b * z - mouse */functioncatAndMouse(x,y,z){constcatA=Math.abs(x-z);constcatB=Math.abs(y-z);console.log(catA,catB);if(catA===catB){return'MouseC';}elseif(catA<catB){return'CatA';}elseif(catA>catB){return'CatB';}}
Cats and a Mouse
You are viewing a single comment's thread. Return to all comments →
JavaScript solution: