Skip to content

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
done
  • Loading branch information
Abdull-Rauf committed Aug 23, 2019
commit e84a6f2e7b658e4bf40ded4135303a86357ba4e2
42 changes: 21 additions & 21 deletions Week1/homework/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,18 @@ let bookTitles = [
'The Catcher in the Rye',
'Pride and Prejudice',
];
//console.log(bookTitles);

// function booksList() {
// let ul = document.createElement('ul');
// let li = document.createElement('li');
// bookTitles.map(book => {
// let li = document.createElement('li');
// li.appendChild(document.createTextNode(book));
// return document.body.appendChild(ul.appendChild(li));
// });
// }
function booksList() {
let ul = document.createElement('ul');
let li = document.createElement('li');
bookTitles.map(book => {
let li = document.createElement('li');
li.appendChild(document.createTextNode(book));
return document.body.appendChild(ul.appendChild(li));
});
}
booksList();

let books = {
book1: {
book_title: 'Harry Potter',
Expand Down Expand Up @@ -66,23 +67,20 @@ let books = {
},
};

// for (let book in books) {
// console.log(books[book]['book_title']);
// console.log(books[book]['author']);
// console.log(books[book]['language']);
// }
for (let book in books) {
console.log(books[book]['book_title']);
console.log(books[book]['author']);
console.log(books[book]['language']);
}

function booksInfo() {
let mainDiv = document.getElementById('main');
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'];
img.setAttribute('width', '250');
img.setAttribute('height', '300');

li.appendChild(img);
p.innerHTML =
Expand All @@ -94,8 +92,10 @@ function booksInfo() {
'</br>' +
'Language: ' +
books[book]['language'];

li.appendChild(p);
return mainDiv.append(ul.appendChild(li));
ul.appendChild(li);
}
document.body.appendChild(ul);
}
booksInfo();
booksDetails();
7 changes: 6 additions & 1 deletion Week1/homework/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ li {
grid-template-rows: auto;
grid-gap: 3em;
float: left;
border-bottom-style: dotted;
border-bottom: 1px solid;
text-align: center;
text-decoration: none;
padding: 1em;
Expand All @@ -25,4 +25,9 @@ li>p {
width: 300px;
text-align: left;

}

img {
width: 150px;
height: 200px;
}
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy