forked from HackYourFuture/JavaScript2
-
Notifications
You must be signed in to change notification settings - Fork 33
Week3 #24
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
Nouransaeed
wants to merge
15
commits into
foocoding:master
Choose a base branch
from
Nouransaeed:week3
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
Week3 #24
Changes from 1 commit
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
b805713
add
Nouransaeed b757fdd
pull request
Nouransaeed 4c4690d
pull request
Nouransaeed 5263def
add pics
Nouransaeed 40e4ccb
add pics
Nouransaeed e45c2c1
homewrok change
Nouransaeed 9ec3cd4
homeowork2
Nouransaeed 58d7c4a
homeowrk3
Nouransaeed 8a2a4bb
4 h
Nouransaeed 9376435
h 5
Nouransaeed 963fdde
homework6
Nouransaeed 5723d20
formatting
Nouransaeed bb1baa6
Co-authored-by: Gabe Rodriguez <grod220@gmail.com>
Nouransaeed 5e575a9
correct
Nouransaeed 19699c4
Delete app2.js
Nouransaeed 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
correct
- Loading branch information
commit 5e575a9cd8af656f6ad88e750c8383048523881b
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,100 +1,65 @@ | ||
'use strict'; | ||
|
||
const titles = [ | ||
'harry_potter_chamber_secrets', | ||
'alchemist', //Paulo coelho | ||
'paula', | ||
'orlando', | ||
'divine-comedy', | ||
'the-odyssey', | ||
]; | ||
|
||
let objBooks = { | ||
"harry_potter_chamber_secrets": { | ||
title :"harry_potter_chamber_secrets", | ||
|
||
'use strict' | ||
const books = [ | ||
{ | ||
title :"Harry Potter Chamber of Secrets", | ||
language:"english", | ||
author:"Joanne K. Rowling" | ||
author:"Joanne K. Rowling", | ||
|
||
}, | ||
"alchemist": { | ||
title:"alchemist", | ||
|
||
{ | ||
title:"Alchemist", | ||
language:"english", | ||
author:"paulo-coelho", | ||
author:"paulo-co", | ||
|
||
}, | ||
|
||
"paula": { | ||
title:"paula", | ||
language:"english", | ||
author:"isabel allende", | ||
}, | ||
"orlando": | ||
{ | ||
title:"orlando", | ||
|
||
language:"english", | ||
|
||
author:"virgina wolf", | ||
|
||
}, | ||
"divine-comedy" : | ||
{ | ||
|
||
title:"divine-comedy", | ||
|
||
language:"English", | ||
|
||
author:"dante", | ||
|
||
}, | ||
|
||
"the-odyssey": | ||
{ | ||
|
||
title:"the-odyssey", | ||
|
||
language: "english", | ||
|
||
author:"homeros", | ||
|
||
} | ||
} | ||
|
||
const ul = document.createElement('ul'); | ||
|
||
ul.setAttribute('id', 'booktitle'); | ||
|
||
|
||
|
||
|
||
/* function listBooks() { | ||
// let i = 0; // this is unnecessary | ||
let ul = document.createElement('ul') | ||
for (let i = 0; i < title.length; i++) { | ||
let li = document.createElement('li'); | ||
li.textContent = title[i]; | ||
ul.appendChild(li); | ||
} | ||
// we don't do anything with the ul | ||
// ??? | ||
} | ||
|
||
document.body.appendChild(ul); // where does ul come from? This will throw an error. | ||
document.body.onload = listBooks; | ||
const objBooksArr = []; | ||
for (const newListBooks in objBooks) { | ||
console.log(newListBooks); | ||
objBooksArr.push(objBooks[newListBooks]) | ||
} | ||
{ | ||
title:"Paula", | ||
language:"english", | ||
author:"isabel allende", | ||
|
||
}, | ||
|
||
{ | ||
|
||
const bookPic = { | ||
title:"Orlando", | ||
language:"english", | ||
author:"virginia-wolf", | ||
|
||
'harry_potter_chamber_secrets':potter.jpg , | ||
'alchemist':alchemist, | ||
'paula' :paula.jpg, | ||
'orlando':woolf.jpg, | ||
'divine-comedy':divine.jpg, | ||
'the-odyssey' :odyssy.jpg, | ||
}; | ||
}, | ||
|
||
{ | ||
title:"Divine Comedy", | ||
language:"English", | ||
author:"dante", | ||
|
||
}, | ||
|
||
{ | ||
title:"The Odyssey", | ||
language: "english", | ||
author:"Homeros", | ||
|
||
}, | ||
|
||
] | ||
|
||
function createAndAppend(parent,typ,attributes={}) { | ||
|
||
const elem = document.createElement(typ) | ||
|
||
parent.appendChild(elem) | ||
|
||
for (const key in attributes) | ||
|
||
elem[key] = attributes[key] | ||
return elem | ||
} | ||
|
||
const ul = createAndAppend(document.body, 'ul', {}) | ||
for (const index in books) { | ||
const book = books[index] | ||
createAndAppend(ul, 'li', {value : index, innerHTML: book.title}) | ||
} |
Empty 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 |
---|---|---|
@@ -1,11 +1,10 @@ | ||
<!-- replace this with your HTML content --> | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title> Book Titles</title> | ||
<script src="app.js"></script> | ||
|
||
</head> | ||
<body> | ||
<div id="obj-books-Arr"></div> | ||
<script src="app.js"></script> | ||
</body> | ||
</html> | ||
</html> |
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.
Looks like an extra space here. In fact, I think there looks like to be lots of strange spacing. Can you run prettier on your files so they fix the formatting issues?