+-image above (saved in Notes folder and available on link) shows the parent relationships for each node
+-note that elements don't innately have text.. but they may have children text nodes that can be accessed with innerHTML
+-innerHTML accesses the nodeValue of the first child
+-can also access the first child with the following syntax:
+ var myTitle = document.getElementById("demo").childNodes[0].nodeValue;
+-nodeName specifies the name of a node and:
+ -is read-only
+ -nodeName of an element node is the same as the tag name
+ -nodeName of an attribute is the attribute name
+ -nodeName of a text node is #text
+ -nodeName of the document as a whole is #document
+-nodeValue can also be used to access a node and:
+ -nodeValue of an element is null
+ -nodeValue of a text node is the text itself
+ -nodeValue for attribute nodes is the attribute itself
+-nodeType is read-only and returns the type of the node
+ -the type will be a numerical value - see a list of some at the link above
+
+
+-all about creating and removing nodes (elements)
+-to add a new element to the DOM, create the element node first, then append it to an existing element
+ -syntax example:
+ This is a paragraph.
+This is another paragraph.
+This is a paragraph.
+This is another paragraph.
+This is a paragraph.
+This is another paragraph.
+This is a paragraph.
+This is another paragraph.
+Hello World!
+ + + +
+
+
+
diff --git a/Week1/homework/app.js b/Week1/homework/app.js
index a9b5f75d8..16b0bb512 100644
--- a/Week1/homework/app.js
+++ b/Week1/homework/app.js
@@ -3,9 +3,131 @@
{
const bookTitles = [
// Replace with your own book titles
- 'harry_potter_chamber_secrets',
+ 'kushiels_avatar',
+ 'dragons_of_autumn_twilight',
+ 'basho_the_complete_haiku',
+ 'the_wit_and_wisdom_of_mark_twain',
+ 'the_waste_land_and_other_poems',
+ 'popco',
+ 'kushiels_scion',
+ 'neverwhere',
+ 'the_sandman',
+ 'the_coldfire_trilogy',
];
+ const favoriteBooks = {
+ popco: {
+ title: 'Popco',
+ language: 'English',
+ author: 'Scarlett Thomas',
+ cover: 'https://images.gr-assets.com/books/1347962344l/4285468.jpg',
+ },
+ kushiels_avatar: {
+ title: "Kushiel's Avatar",
+ language: 'English',
+ author: 'Jacqueline Carey',
+ cover: 'https://images.gr-assets.com/books/1233366080l/40223.jpg',
+ },
+ kushiels_scion: {
+ title: "Kushiel's Scion",
+ language: 'English',
+ author: 'Jacqueline Carey',
+ cover: 'https://images.gr-assets.com/books/1344265086l/153007.jpg',
+ },
+ neverwhere: {
+ title: 'Neverwhere',
+ language: 'English',
+ author: 'Neil Gaiman',
+ cover: 'https://images.gr-assets.com/books/1523573978l/39821861.jpg',
+ },
+ the_wit_and_wisdom_of_mark_twain: {
+ title: 'The Wit And Wisdom Of Mark Twain',
+ language: 'English',
+ author: 'Mark Twain',
+ cover: 'https://images.gr-assets.com/books/1388209857l/2965.jpg',
+ },
+ the_waste_land_and_other_poems: {
+ title: 'The Waste Land and Other Poems',
+ language: 'English',
+ author: 'T.S. Eliot',
+ cover: 'https://images.gr-assets.com/books/1372992691l/400412.jpg',
+ },
+ dragons_of_autumn_twilight: {
+ title: 'Dragons of Autumn Twilight',
+ language: 'English',
+ author: 'Margaret Weis and Tracy Hickman',
+ cover: 'https://images.gr-assets.com/books/1220752967l/1082252.jpg',
+ },
+ basho_the_complete_haiku: {
+ title: 'Basho: The Complete Haiku',
+ language: 'English, Japanese',
+ author: 'Matsuo Basho',
+ cover: 'https://images.gr-assets.com/books/1371446834l/2183600.jpg',
+ },
+ the_coldfire_trilogy: {
+ title: 'The Coldfire Trilogy',
+ language: 'English',
+ author: 'C.S. Friedman',
+ cover: 'https://images.gr-assets.com/books/1437435124l/36159.jpg',
+ },
+ the_sandman: {
+ title: 'The Sandman',
+ language: 'English',
+ author: 'Neil Gaiman',
+ cover: 'https://images.gr-assets.com/books/1352657721l/16142737.jpg',
+ },
+ };
+
// Replace with your own code
- console.log(bookTitles);
+ // console.log(bookTitles);
+
+ function displayList(titles) {
+ const list = document.createElement('ul'); // creates list
+ list.setAttribute('id', 'books'); // adding id of books
+ document.body.appendChild(list);
+ // list.innerHTML = 'My favorite books, with authors and languages.';
+
+ for (let i = 0; i < titles.length; i++) {
+ const titleList = document.createElement('li'); // creates each title item (li)
+ titleList.setAttribute('id', titles[i]); // sets id of each item of the list
+ list.appendChild(titleList); // adds item (li) to list(ul)
+ const titleKey = titles[i]; // id for object call
+ titleList.innerHTML += favoriteBooks[titleKey].title; // adds title of each to list
+ document.write('