Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function asd(input){
- let book=input[0]
- let index=1
- let found=false
- let bookFav=input[index]
- while(bookFav!=='No More Books'){
- if(bookFav===book){
- found=true
- break
- }
- index++
- bookFav=input[index]
- }
- if(found===false){
- console.log(`The book you search is not here!`)
- console.log(`You checked ${index-1} books.`)
- }else{
- console.log(`You checked ${index-1} books and found it.`)
- }
- }
- asd(["The Spot",
- "Hunger Games",
- "Harry Potter",
- "Torronto",
- "Spotify",
- "No More Books"])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement