This repository was archived by the owner on May 14, 2024. It is now read-only.
Repository navigation
corrected version homework week1 #266
Closed
Closed
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
|---|---|---|
|
|
@@ -59,3 +59,7 @@ typings/ | |
|
|
||
| .netlify | ||
| dist/ | ||
| live | ||
| exercise | ||
| live2 | ||
|
|
||
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
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 |
|---|---|---|
|
|
@@ -2,10 +2,120 @@ | |
|
|
||
| { | ||
| const bookTitles = [ | ||
| // Replace with your own book titles | ||
| 'harry_potter_chamber_secrets' | ||
| 'So_Long_A_Letter', | ||
| 'Macbeth', | ||
| 'Julius_Caesar', | ||
| 'Silas_Marner', | ||
| 'The_Gods_Are_Not_To_Blame', | ||
| 'Things_Fall_Apart', | ||
| 'Database_Processing', | ||
| 'JavaScript_For_Web_Developers', | ||
| 'Installing_And_Configuring_Windows_10', | ||
| 'Installing_And_Configuring_Windows_Server_2012_R2' | ||
| ]; | ||
|
|
||
| // Replace with your own code | ||
| console.log(bookTitles); | ||
| const booksInformation = { | ||
| So_Long_A_Letter: { | ||
| title: 'So Long A Letter', | ||
| language: 'French', | ||
| author: 'Mariama Ba' | ||
| }, | ||
| Macbeth: { | ||
| title: 'Macbeth', | ||
| language: 'English', | ||
| author: 'William Shakespeare' | ||
| }, | ||
| Julius_Caesar: { | ||
| title: 'Julius Caesar', | ||
| language: 'English', | ||
| author: 'William Shakespeare' | ||
| }, | ||
| Silas_Marner: { | ||
| title: 'Silas Marner', | ||
| language: 'English', | ||
| author: 'George Eliot' | ||
| }, | ||
| The_Gods_Are_Not_To_Blame: { | ||
| title: 'The Gods Are Not To Blame', | ||
| language: 'English', | ||
| author: 'Ola Rotimi' | ||
| }, | ||
| Things_Fall_Apart: { | ||
| title: 'Things Fall Apart', | ||
| language: 'English', | ||
| author: 'Chinua Achebe' | ||
| }, | ||
| Database_Processing: { | ||
| title: 'Database Processing', | ||
| language: 'English', | ||
| author: 'David Kroenke' | ||
| }, | ||
| JavaScript_For_Web_Developers: { | ||
| title: 'JavaScript For Web Developers', | ||
| language: 'English', | ||
| author: 'Nicholas C. Zakas' | ||
| }, | ||
| Installing_And_Configuring_Windows_10: { | ||
| title: 'Installing And Configuring Windows 10', | ||
| language: 'English', | ||
| author: 'Andrew Bettany' | ||
| }, | ||
| Installing_And_Configuring_Windows_Server_2012_R2: { | ||
| title: 'Installing And Configuring Windows Server 2012 R2', | ||
| language: 'English', | ||
| author: 'Craig Zacker' | ||
| } | ||
| }; | ||
|
|
||
| function createList() { | ||
| const ul = document.createElement('ul'); | ||
| document.body.appendChild(ul); | ||
| for (const bookTitle of bookTitles) { | ||
| const li = document.createElement('li'); | ||
| ul.appendChild(li); | ||
| li.setAttribute('id', bookTitle); | ||
| const bookInfo = booksInformation[bookTitle]; | ||
|
|
||
| const h2 = document.createElement('h2'); | ||
| li.appendChild(h2); | ||
| h2.textContent = bookInfo.title; | ||
|
|
||
| const h3 = document.createElement('h3'); | ||
| li.appendChild(h3); | ||
| h3.textContent = bookInfo.language; | ||
|
|
||
| const p = document.createElement('p'); | ||
| li.appendChild(p); | ||
| p.textContent = bookInfo.author; | ||
| } | ||
| } | ||
|
|
||
| const bookCovers = { | ||
| So_Long_A_Letter: './images/So_Long_A_Letter.jpeg', | ||
| Macbeth: './images/Macbeth.jpeg', | ||
| Julius_Caesar: './images/Julius_Caesar.jpeg', | ||
| Silas_Marner: './images/Silas_Marner.jpeg', | ||
| The_Gods_Are_Not_To_Blame: './images/The_Gods_Are _Not _To _Blame.jpeg', | ||
| Things_Fall_Apart: './images/Things_Fall_Apart.jpeg', | ||
| Database_Processing: './images/Database_Processing.jpg', | ||
| JavaScript_For_Web_Developers: './images/JavaScript_For_Web_Developers.jpeg', | ||
| Installing_And_Configuring_Windows_10: './images/Installing_And_Configuring_Windows_10.jpg', | ||
| Installing_And_Configuring_Windows_Server_2012_R2: | ||
| './images/Installing_And_Configuring_Windows_Server_2012.jpg' | ||
| }; | ||
|
|
||
| function displayBooks() { | ||
| for (const key of Object.keys(bookCovers)) { | ||
| const li = document.getElementById(key); | ||
| const img = document.createElement('img'); | ||
| li.appendChild(img); | ||
| img.setAttribute('src', `${bookCovers[key]}`); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. HTML validation error (for all
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi Jim, |
||
| } | ||
| } | ||
|
|
||
| function main() { | ||
| createList(); | ||
| displayBooks(); | ||
| } | ||
| window.onload = main; | ||
| } | ||
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.
Binary file added
BIN
+48.2 KB
Week1/homework/images/Installing_And_Configuring_Windows_Server_2012.jpg
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.
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,14 @@ | ||
| <!-- replace this with your HTML content --> | ||
| <!-- 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" /> | ||
| <title>JavaScript2 Week1</title> | ||
| <link rel="stylesheet" href="style.css" /> | ||
| </head> | ||
| <body> | ||
| <script src="app.js"></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,26 @@ | ||
| /* add your styling here */ | ||
| body { | ||
| background-color: #8fbc8f; | ||
| width: auto; | ||
| padding: 10%; | ||
| display: flex; | ||
| } | ||
|
|
||
| img { | ||
| width: 45%; | ||
| border-radius: 10%; | ||
| } | ||
|
|
||
| ul { | ||
| text-decoration-style: none; | ||
| } | ||
|
|
||
| li { | ||
| list-style: none; | ||
| font-size: 120%; | ||
| font-weight: bold; | ||
| } | ||
|
|
||
| p { | ||
| font-style: italic; | ||
| color: grey; | ||
| } |
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 |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| 'use strict'; | ||
|
|
||
| const numbers = [1, 2, 3, 4]; | ||
|
|
||
| let sum = 0; | ||
| for (const number of numbers) { | ||
| sum += number; | ||
| } | ||
|
|
||
| console.log(sum); |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The HTML validator gives this error message: