Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on May 14, 2024. It is now read-only.

JS2/Week1/Shvan #326

Closed
wants to merge 3 commits into from
Closed

JS2/Week1/Shvan #326

wants to merge 3 commits into from

Conversation

Shvan1
Copy link

@Shvan1 Shvan1 commented May 19, 2019

No description provided.

@Shvan1 Shvan1 changed the title TEST TEST//JS2/Week1/Shvan May 19, 2019
@Shvan1 Shvan1 changed the title TEST//JS2/Week1/Shvan JS2/Week1/Shvan May 25, 2019
//console.log(bookIds);

//3.
function books(bookIds) {
Copy link
Contributor

Choose a reason for hiding this comment

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

It's better to give a function a more 'active' name, that includes a verb. This is because a function is a tool you're using to get a certain job done. In this case, you could call it "displayBookList" or "renderBookTitles".

Copy link
Contributor

@NoerGitKat NoerGitKat left a comment

Choose a reason for hiding this comment

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

Overall, nice job doing the exercises. I can see you're still trying to understand what the purpose of all of these elements are but you are getting there!

window.addEventListener('load', books);

//4.
const DifferentBooks = {
Copy link
Contributor

Choose a reason for hiding this comment

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

The name of this variable can be more meaningful, like "bookDetails".

//8.
function covers() {
const div = document.getElementById('items');
const div2 = document.createElement('h1');
Copy link
Contributor

Choose a reason for hiding this comment

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

Same advice here: naming variables and functions to be meaningful is very important. This is because you'll be reading your code over and over again, so a meaningful name helps you much quicker understand what's happening.

divTag.className = 'my-books';
const ul = document.createElement('ul');
ul.className = 'books';
bookIds.forEach(function(index) {
Copy link
Contributor

Choose a reason for hiding this comment

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

For consistency you could've used a for-loop again. It might look different, but both constructs (a for-loop and forEach) essentially do the same.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants