forked from HackYourFuture/JavaScript2
-
Notifications
You must be signed in to change notification settings - Fork 33
Homework week1 #2
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
Open
annagabain
wants to merge
20
commits into
foocoding:master
Choose a base branch
from
annagabain:homework-week1
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
6d16904
Update VSCode settings
remarcmij 304da26
Update MAKEME.md
remarcmij c7aa57c
Correct typo
remarcmij 513ace2
Fix broken link
remarcmij a88dec3
Update MAKEME.md
NoerGitKat 90b74a5
Removed redundant and erroneous text.
remarcmij e34d7ab
classrum excercise 09 06 2019
annagabain 7bdc585
at2
annagabain 2be8472
freecodecamp excercise
annagabain 6dc778b
Solution2
annagabain 4d73148
json installs from js2 w1
annagabain 23a400b
ex app till 1.5
annagabain 200a38d
app ex till 1.5 to be continued
annagabain da911d1
del
annagabain 56f7fc6
synch
annagabain cc6a3ff
link
annagabain a851391
h
annagabain 75aba93
all in one folder fix
annagabain 28e1692
sq added
annagabain 58bf533
Rename app.js to MY-app.js
annagabain 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
ex app till 1.5
- Loading branch information
commit 23a400b16eaf5ce160034cca705f43adc45cc360
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"type": "node", | ||
"request": "launch", | ||
"name": "Launch Program", | ||
"program": "${file}" | ||
} | ||
] | ||
} |
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,3 @@ | ||
{ | ||
"git.ignoreLimitWarning": true | ||
} |
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,27 +1,136 @@ | ||
'use strict'; | ||
|
||
{ | ||
const favoriteGames = [ | ||
// Replace with your own book titles | ||
const favoriteBooks = [ | ||
//1.1 Replace with your own book titles | ||
'harry_potter_chamber_secrets', | ||
'call_of_the_wild', | ||
'the_turtle', | ||
'snowball_and_the_bunny_adventures', | ||
'chicken_little', | ||
'hey_friend', | ||
'it_is_chilly_out_there', | ||
'stone_and_pain', | ||
'maybe_tomorrow', | ||
'alise_in_wonderland', | ||
]; | ||
|
||
// Replace with your own code | ||
console.log(favoriteGames); | ||
// document.body.onload = addElement; | ||
// function displayGameTitles = () => { | ||
// 1.2 Replace with your own code | ||
|
||
let unorderedList = document.createElement("ul"); | ||
for (const gameIndex in favoriteGames) { | ||
const listItem = document.createElement("li"); | ||
listItem.textContent = favoriteGames[gameIndex]; | ||
unorderedList.appendChild(listItem); | ||
//console.log(favoriteBooks); | ||
|
||
//1.3 Remove the temporary console.log from step 1.1. Make a function (or functions) that generate a ul with li elements for each book ID | ||
// in the array using a for loop. Make sure that the function names you choose are an accurate reflection of what they do. As a reminder, | ||
//here are the recommended Naming Conventions. | ||
|
||
// // // function generateList(){ | ||
// // // let booksList = document.createElement('ul'); | ||
// // // booksList.setAttribute('id', 'li'); | ||
// // // document.body.appendChild(booksList); | ||
|
||
// // // let index; | ||
// // // for (index in favoriteBooks) { | ||
// // // let booksListItem = document.createElement('li'); | ||
// // // booksList.appendChild(booksListItem); | ||
// // // booksListItem.textContent = favoriteBooks[index]; | ||
// // // } | ||
// // // } | ||
// // // generateList(); | ||
|
||
// let unorderedList = document.createElement("ul"); | ||
// for (const gameIndex in favoriteBooks) { | ||
// const listItem = document.createElement("li"); | ||
// listItem.textContent = favoriteBooks[gameIndex]; | ||
// unorderedList.appendChild(listItem); | ||
// } | ||
|
||
// // add the newly created element and its content into the DOM | ||
// const currentDiv = document.getElementById("gameDiv"); | ||
// document.body.insertBefore(unorderedList, currentDiv); | ||
|
||
|
||
|
||
// // 1.4 Make an object (not an array!) containing information for each book. Each property of this object should be another (i.e., nested) | ||
// object with the book ID you thought up in step 1.1 as a key, and at least the following properties: title, language and author. | ||
let bookProperties = { | ||
harry_potter_chamber_secrets:{ | ||
title:"Harry Potter: Chamber of Secrets", | ||
language:"English", | ||
author:"Joanne K. Rowling", | ||
}, | ||
call_of_the_wild:{ | ||
title:"Call of the Wild", | ||
language:"English", | ||
author:"Jack London", | ||
}, | ||
the_turtle:{ | ||
title:"The Turtle", | ||
language:"Anna -ish", | ||
author:"Imaginery", | ||
}, | ||
snowball_and_the_bunny_adventures:{ | ||
title:"Snowball and the Bunny Adventures", | ||
language:"Anna -ish", | ||
author:"Imaginery van Children", | ||
}, | ||
chicken_little:{ | ||
title:"Chicken Little - The Sky is Falling", | ||
language:"English", | ||
author:"Folk Tale", | ||
}, | ||
hey_friend:{ | ||
title:"Hey Friend", | ||
language:"Anna -ish", | ||
author:"Imaginery", | ||
}, | ||
it_is_chilly_out_there:{ | ||
title:"It is Chilly out There", | ||
language:"Anna -ish", | ||
author:"Imaginery", | ||
}, | ||
stone_and_pain:{ | ||
title:"Stone and Pain - The Life of Michelangelo Buonarotti", | ||
language:"Chech", | ||
author:"Karrel Schulz", | ||
}, | ||
maybe_tomorrow:{ | ||
title:"Maybe Tomorrow", | ||
language:"Anna -ish", | ||
author:"Imaginery Delayer", | ||
}, | ||
alise_in_wonderland:{ | ||
title:"Alise in Wonderland", | ||
language:"English", | ||
author:"Lewis Carrol", | ||
} | ||
} | ||
|
||
|
||
// // 1.5 Now change the function from step 1.3 that you used to display the book ID's in a list to take the actual information about the book | ||
// from the object and display that. Make sure you choose the correct HTML elements for each piece of info, for instance, a heading for the title. | ||
function generateList(){ | ||
let booksList = document.createElement('ul'); | ||
booksList.setAttribute('id', 'li'); | ||
document.body.appendChild(booksList); | ||
|
||
let index; | ||
|
||
for (index in favoriteBooks) { | ||
let booksListItem = document.createElement('li'); | ||
booksList.appendChild(booksListItem); | ||
|
||
let BooksID = favoriteBooks[index]; | ||
booksListItem.textContent = favoriteBooks[index]; | ||
} | ||
// add the newly created element and its content into the DOM | ||
const currentDiv = document.getElementById("gameDiv"); | ||
document.body.insertBefore(unorderedList, currentDiv); | ||
} | ||
generateList(); | ||
|
||
// // 1.6 Beautify your html page with css (use the style.css file for that), add sources and alts to each of the images. | ||
|
||
// // 1.7 Find and download book covers for each book and construct a new object which has as keys the book IDs again, and as value the path to | ||
// the image source (e.g. { harry_potter_blabla: './img/harry_potter_blabla.jpg', ... }). | ||
|
||
// // 1.8 Loop over these entries (hint: Object.keys(objectName) gives you an array containing the keys). Then write a function which places an | ||
// image at the corresponding li element. Remember that objects are not ordered, so you cannot guarantee that the first key is the first li element. | ||
// (Hint: you could give each li item an id tag by modifying the function you made before.) | ||
} |
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,29 @@ | ||
<!-- replace this with your HTML content --> | ||
<!DOCTYPE html> | ||
|
||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<title>FavoriteBooks Excercise</title> | ||
</head> | ||
<body> | ||
<script src="app.js"></script> | ||
|
||
</body> | ||
</html> | ||
|
||
|
||
|
||
|
||
<!-- <!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<title>FavoriteBooks Excercise</title> | ||
</head> | ||
<body> | ||
<script src="app.js"></script> | ||
<div id = gameDiv></div> | ||
<ul> | ||
|
||
</ul> | ||
</body> | ||
</html> | ||
</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 |
---|---|---|
@@ -0,0 +1 @@ | ||
ggg |
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 @@ | ||
ggg |
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.
I've never played any of those games!
Need to look into it. Cool stuff 👍
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.
;) good luck