Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function maxima(input) {
- //Input
- let favBook = input[0];
- let libraryCapacity = input[1];
- let i = 2;
- //Code
- while (i <= input.length) {
- let bookChecker = input[i];
- if (bookChecker === favBook) {
- console.log(`You checked ${i - 2} books and found it.`);
- break;
- } else if (bookChecker === undefined) {
- console.log("The book you search is not here!");
- console.log(`You checked ${i - 2} books.`);
- }
- i++;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement