dimanche 16 décembre 2018

if statement and for loop JavaScript

I would like my program to simulate a library system that you can borrow a book for rev 7 days and it will be automatically re loan for 7 days if there's no one wanted the book. but you have to bring the book back if there's somebody wanted it, I don't know how to make this condition active if can help me that would be very nice thank you.

 let months = ['Jan']; // 

 let loan;
 let request = '';

 months.forEach(month => {   // Java Script function. 
   for (loan = 0; loan < 30; loan++) {       // for loop that you can test
     if (loan === 7) {
       console.log('Your loan will be reloaned');
     }

     if (loan === 14) {
       console.log('You have to return the book!');
       break;
     }

     console.log({ loan });
   }
 });

Aucun commentaire:

Enregistrer un commentaire