forked from HackYourFuture/JavaScript2
-
Notifications
You must be signed in to change notification settings - Fork 33
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,97 @@ | ||
| 'use strict'; | ||
|
|
||
| { | ||
| const bookTitles = [ | ||
| // Replace with your own book titles | ||
| 'harry_potter_chamber_secrets', | ||
| ]; | ||
|
|
||
| // Replace with your own code | ||
| console.log(bookTitles); | ||
| let bookTitles = [ | ||
| 'Harry_Potter', | ||
| 'The Great_Gatsby', | ||
| 'To_Kill_a _Mockingbird', | ||
| 'The_Hobbit', | ||
| 'Fahrenheit_451', | ||
| 'The Catcher_in_the_Rye', | ||
| 'Pride_and_Prejudice', | ||
| ]; | ||
|
|
||
| function booksList() { | ||
| let bookList = document.createElement('div'); | ||
| let ul = document.createElement('ul'); | ||
| bookTitles.map(book => { | ||
| let li = document.createElement('li'); | ||
| let bookNames = book.replace(/_/g, ' '); | ||
| li.appendChild(document.createTextNode(bookNames)); | ||
| ul.appendChild(li); | ||
| return document.body.appendChild(bookList.appendChild(ul)); | ||
| }); | ||
| } | ||
| booksList(); | ||
|
|
||
| let books = { | ||
| book1: { | ||
| book_title: 'Harry Potter', | ||
| author: 'J.K Rowling', | ||
| language: 'English', | ||
| cover_image: 'harrypotter.jpg', | ||
| }, | ||
| book2: { | ||
| book_title: 'The Great Gatsby', | ||
| author: 'F. Scott Fitzgerald', | ||
| language: 'English', | ||
| cover_image: 'thegreat.jpg', | ||
| }, | ||
| book3: { | ||
| book_title: 'To Kill a Mockingbird', | ||
| author: 'Harper Lee', | ||
| language: 'English', | ||
| cover_image: 'tokill.jpg', | ||
| }, | ||
| book4: { | ||
| book_title: 'The Hobbit', | ||
| author: 'J.R.R. Tolkien', | ||
| language: 'English', | ||
| cover_image: 'thehobbit.jpg', | ||
| }, | ||
| book5: { | ||
| book_title: 'Fahrenheit 451', | ||
| author: 'Ray Bradbury', | ||
| language: 'English', | ||
| cover_image: 'fahrenheit.jpg', | ||
| }, | ||
| book6: { | ||
| book_title: 'The Catcher in the Rye', | ||
| author: 'J.D. Salinger', | ||
| language: 'English', | ||
| cover_image: 'thecatcher.jpg', | ||
| }, | ||
|
|
||
| book7: { | ||
| book_title: 'Pride and Prejudice', | ||
| author: 'Jane Austen', | ||
| language: 'English', | ||
| cover_image: 'pap.jpg', | ||
| }, | ||
| }; | ||
|
|
||
| function booksDetails() { | ||
| let ul = document.createElement('ul'); | ||
|
|
||
| for (let book in books) { | ||
| let li = document.createElement('li'); | ||
| let img = document.createElement('IMG'); | ||
| let p = document.createElement('p'); | ||
| img.src = './img/' + books[book]['cover_image']; | ||
|
|
||
| li.appendChild(img); | ||
| p.innerHTML = | ||
| 'Title: ' + | ||
| books[book]['book_title'] + | ||
| '</br>' + | ||
| 'Author: ' + | ||
| books[book]['author'] + | ||
| '</br>' + | ||
| 'Language: ' + | ||
| books[book]['language']; | ||
|
|
||
| li.appendChild(p); | ||
| ul.appendChild(li); | ||
| } | ||
| document.body.appendChild(ul); | ||
| } | ||
| booksDetails(); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,21 @@ | ||
| <!-- replace this with your HTML content --> | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
|
|
||
| <head> | ||
| <meta charset="UTF-8"> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| <meta http-equiv="X-UA-Compatible" content="ie=edge"> | ||
| <link rel="stylesheet" href="./style.css"> | ||
| <title>Books</title> | ||
| </head> | ||
|
|
||
|
|
||
| <body> | ||
| <div id="main"> | ||
|
|
||
| </div> | ||
| <script src="./app.js" type="text/javascript"></script> | ||
| </body> | ||
|
|
||
|
|
||
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,33 @@ | ||
| /* add your styling here */ | ||
| body { | ||
| background-color: rgba(91, 107, 84, 0.438); | ||
| color: rgb(3, 3, 3); | ||
| width: 50%; | ||
| margin: auto; | ||
| } | ||
|
|
||
| li { | ||
| display: grid; | ||
| grid-template-columns: 1fr auto; | ||
| grid-template-rows: auto; | ||
| grid-gap: 3em; | ||
| float: left; | ||
| border-bottom: 1px solid; | ||
| text-align: center; | ||
| text-decoration: none; | ||
| padding: 1em; | ||
| width: 500px; | ||
| } | ||
|
|
||
| li>p { | ||
| font-size: 24px; | ||
| margin: auto 6em auto auto; | ||
| padding: 1em; | ||
| width: 300px; | ||
| text-align: left; | ||
|
|
||
| } | ||
|
|
||
| img { | ||
| width: 150px; | ||
| height: 200px; | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Homework week1 #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Uh oh!
There was an error while loading. Please reload this page.
Homework week1 #25
Changes from all commits
7714fb62b07ffad592be2e84a6f206cbd8aFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.