Results 1 to 5 of 5
  1. #1

    Help with JavaScript project

    Hi I am new here, am learning coding and I'm working on an assignment to make a website with my 10 favorite books. So far I have made it to this point, but I'm confused as to how make the following instructions:

  2. #2

    Help with JavaScript project

    1.-Make an object containing information for each book. Each item (object) in this object should have the book ID you thought up in point 1 as a key, and it should have at least the following fields: title, language and author.

    2.-Now change the function 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 right html elements for each piece of info, for instance, a heading for the title.

  3. #3

    Help with JavaScript project

    3.-Download book covers for each book, construct a new Object which has as keys the bookId's again, and as value the path to the image source (e.g. {"harry_potter_blabla": "./img/harry_potter_blabla.jpg", ...}). Now 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)

  4. #4

    Help with JavaScript project

    let myFaveBooks = ["stranger-in-strange-land","the-foundation-series","", "the-moon-is-a-harsh-mistress", "2001-a-space-odissey", "the-godfather", "pedro-paramo", "isle-of-passion", "the-great-gatsby", "the-house-of-the-spirits", "the-picture-of-dorian-grey"]
    console.log(myFaveBooks) //For porpusses of remembering I put this comments, this I used for the array, always remember when you console.log somethings its printed on the webpage;
    var ul = document.getElementById("recentlist")
    function generateUl() {
    myFaveBooks.forEach(element => {
    console.log(element) //element is myFaveBooks
    var li = document.createElement('li') //the element is the 10 books; myFaveBooks
    li.textContent = element //added content to list
    ul.appendChild(li) //appened <li> to <ul>


  5. #5

    Help with JavaScript project

    All variables have some scope: some portion of your script in which they can be referenced - printed to the screen, say, or used as part of a calculation. Global variables have, unsurprisingly, global scope - they can be accessed (set or read) anywhere in your script. Variables defined with the var keyword have function scope that is more limited; these are variables that might be accessed only within a function (often the function in which they are defined) or some other section of your script. Variables can also have block scope, as we'll see later in this lesson - specific to a block such as a for loop.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts