Advertisement
StefiIOE

lab3.4

Feb 10th, 2020
348
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPEhtml>
  2. <!DOCTYPE html>
  3. <html>
  4. <head>
  5.   <meta charset="utf-8"/>
  6.   <title>About Me</title>
  7. </head>
  8. <body>
  9. </body>
  10. </html>
  11. <script>
  12.   function Book (title,author,alreadyRead) {
  13.     this.title=title;
  14.     this.author=author;
  15.     this.alreadyRead=alreadyRead;
  16.  
  17.   }
  18.   var BookList=new Array ();
  19.   BookList.push=(new Book("Game of Thrones" , "George RR Martin" ,true));
  20.   BookList.push=(new Book("The Girl Before" , "JP Delany" ,true));
  21.   BookList.push=(new Book("Forget me not" , "Ena Rosa" ,true));
  22.   BookList.push=(new Book("Origin" , "Dan Brown" ,false));
  23.   BookList.push=(new Book("The Sun and her flowers" , "Rupi Kaur" ,false));
  24.   BookList.push=(new Book("The Midnight Line" , "Lee Child/" ,false));
  25.   for(var i = 0 ; i<BookList.length; i++)
  26.   {
  27.     if(BookList[i].alreadyRead)
  28.     {
  29.       document.write("You have already read " + BookList[i].title + "by " + BookList[i].author + "<br>");
  30.  
  31.     }
  32.     else
  33.       {
  34.         document.write("You still need to read " + BookList[i].title + " by " + BookList[i].author +"<br>");
  35.       }
  36.   }
  37. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement