Advertisement
Spocoman

01. Smallest of Three Numbers

Jan 28th, 2022
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve (firstNum, secondNum, thirdNum) {
  2.  
  3.     if ( firstNum < secondNum && firstNum < thirdNum){
  4.         console.log(firstNum);
  5.     } else if(secondNum < firstNum && secondNum < thirdNum) {
  6.         console.log(secondNum);
  7.     } else {
  8.         console.log(thirdNum);
  9.     }
  10. }
  11.  
  12. Или с Math.min():
  13.  
  14. function solve (firstNum, secondNum, thirdNum) {
  15.  
  16.     console.log(Math.min(firstNum, secondNum, thirdNum));
  17. }
  18.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement