Skip to content

Conversation

@Hadidreem17
Copy link

No description provided.

@dardecena dardecena self-requested a review October 21, 2025 12:02
Copy link

@dardecena dardecena left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great effort. You are almost there. Please work on Ex 4 and Ex 5.

Comment on lines +21 to +38
const ul = document.createElement ('ul');
books.forEach( book => {
const li = document.createElement ('li');
const p = document.createElement ( 'p');
p.textContent = `${book.title} - ${book.author} `;
const img = document.createElement ('img');
img.src = `https://covers.openlibrary.org/b/isbn/${book.isbn}-M.jpg`;
img.alt = `${book.title} cover`;
li.appendChild (p);
li.appendChild (img);
if (book.alreadyRead) {
li.style.backgroundColor = 'green';
}
else
{ li.style.backgroundColor = 'red'} ;
ul.appendChild (li);
});
return ul;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work!

Comment on lines +2 to +37
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
margin: 0;
padding: 20px;
}
h1 {
text-align: center;
color: #333;
}
ul {
list-style-type: none;
padding: 0;
display : grid ;
grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
gap : 16px;

}
li {
background: #fff;
margin: 10px 0;
padding: 15px;
border-radius: 5px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
img {
width: 100% ;
height: auto ;
border -radius: 5px ;
display : block ;

}
p {
margin: 0;
padding: 0;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment on lines +11 to +23
function aboutMe() {
const nickname = document.querySelector ('#nickname');
nickname.textContent = 'Rim';
const favFood = document.querySelector ('#fav-food');
favFood.textContent = 'Sushi';
const hometown = document.querySelector ('#hometown');
hometown.textContent = 'Tokyo';
const listItems = document.querySelectorAll ('li');
listItems.forEach(item => {
item.classList.add('list-item');
});
}
aboutMe();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great!

Comment on lines +1 to +11

body {

font-family: Arial, sans-serif;
margin: auto;
padding: 20px;
}

.list-item {
color: red ;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment on lines +10 to +13
const logo = document.querySelector('img[alt="Google"]') ;
logo.src = 'https://www.hackyourfuture.be/static/logo.png';
logo.srcset = 'https://www.hackyourfuture.be/static/logo.png';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good!

Comment on lines +10 to +11
document.querySelector('time').textContent= new Date().toLocaleTimeString() ;
setInterval(addCurrentTime, 1000) ;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: Almost there, but not quite.
Hint:
Where on the document do you want to display the time? header? body? etc.

Comment on lines +23 to +60
window.addEventListener('load', function () {
const cat = document.querySelector('img');
const originalSrc = cat.src || 'http://www.anniemation.com/clip_art/images/cat-walk.gif';
const danceSrc = 'https://media1.tenor.com/images/2de63e950fb254920054f9bd081e8157/tenor.gif';

cat.style.position = 'absolute';
cat.style.left = '0px';

let hasDanced = false;
let walkTimer = null;

function catWalk() {
const x = parseInt(cat.style.left, 10) || 0;
const rightEdge = window.innerWidth - cat.width;
const mid = rightEdge / 2;

if (x >= rightEdge) {
cat.style.left = '0px';
hasDanced = false;
return;
}

if (!hasDanced && x >= mid) {
hasDanced = true;
clearInterval(walkTimer);
cat.src = danceSrc;
setTimeout(function () {
cat.src = originalSrc;
walkTimer = setInterval(catWalk, 50);
}, 5000);
return;
}

cat.style.left = (x + 10) + 'px';
}

walkTimer = setInterval(catWalk, 50);
});

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: Good effort but not quite there yet. I see the cat walking in place. It doesn't meet the requirements of walking across the screen from left to right and doing a dance for 50ms in the middle of the screen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants