Ledger Nano X - The secure hardware wallet
SHARE
TWEET

Untitled

a guest Apr 4th, 2020 193 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function exam(examHr, examMn, arriveHr, arriveMn){
  2.     examHr = Number(examHr);
  3.     examMn = Number(examMn);
  4.     arriveHr = Number(arriveHr);
  5.     arriveMn = Number(arriveMn);
  6.     let totalExamMn = examHr*60 + examMn;
  7.     let totalAriveTime = arriveMn + arriveHr*60;
  8.     let diff = totalExamMn - totalAriveTime;
  9.     let hr = Math.abs(diff/60);
  10.     hr = Math.floor(hr);
  11.     let mn =  Math.abs(diff % 60);
  12.     if(diff === 0 ){
  13.         console.log('On time');
  14.     }else if(diff <= 30 && diff > 0){
  15.         console.log('On time');
  16.         console.log(`${mn} minutes before the start`);
  17.     }
  18.     if(mn < 10){
  19.         mn = `0${mn}`;
  20.     }    
  21.      if(diff > 30){        
  22.             if(hr >= 1){
  23.                 console.log('Early');
  24.                 console.log(`${hr}:${mn} hours before the start`);
  25.             }else{
  26.                 console.log('Early');
  27.                 console.log(`${mn} minutes before the start`);
  28.             }
  29.         }        
  30.     else if(diff < 0){      
  31.              if(diff < - 60){
  32.                 console.log('Late');
  33.                 console.log(`${hr}:${mn} hours after the start`);
  34.             }else{
  35.                 console.log('Late');
  36.                 console.log(`${mn} minutes after the start`);
  37.             }
  38.         }
  39.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top