00:02:55 Robert Piper: Hi everyone. no questions yet ;-) 00:03:09 Zac Gordon: Good good! Hi Robert :) 00:04:22 Zac Gordon: 1. Create a variable called container . For the value, get the div with an ID of "container" from the page. Log it to the console to test. 00:04:56 Zac Gordon: https://raw.githubusercontent.com/zgordon/javascript-explained/master/04-browser-api-exercises/starter/exercise-01.html 00:05:03 Zac Gordon: https://raw.githubusercontent.com/zgordon/javascript-explained/master/04-browser-api-exercises/starter/exercise-01.html 00:06:53 Zac Gordon: 2. Log out the HTML inside of firstHeader to the console. Log out the text inside of firstHeader to the console. 00:07:15 Zac Gordon: https://raw.githubusercontent.com/zgordon/javascript-explained/master/04-browser-api-exercises/starter/exercise-05.html 00:09:03 Zac Gordon: 3. Map over the linksArray and log out the text of each link. 00:09:17 Zac Gordon: https://raw.githubusercontent.com/zgordon/javascript-explained/master/04-browser-api-exercises/starter/exercise-11.html 00:12:15 Zac Gordon: 4. Create a function called header( title ) that takes a title as a parameter and then returns the following string with the title:

TITLE

. Log out header( `My Header` ) to test. Add the dynamic header inside of the
right before the closing of the div. Use insertAdjacentHTML(). https://raw.githubusercontent.com/zgordon/javascript-explained/master/04-browser-api-exercises/starter/exercise-15.html 00:18:28 Zac Gordon: 5. Create an event handler function called logTitle( e ). Have the function prevent the default event behavior. Then have it log out the innerText of whatever was just interacted with. Map over the linksArray from before and attach logTitle as an event listener to each link when it is clicked on. Try clicking and checking the console to test. https://raw.githubusercontent.com/zgordon/javascript-explained/master/04-browser-api-exercises/starter/exercise-18.html 00:29:23 Robert Piper: linksArray.map( link => console.log(link.innerText) ) 00:29:56 ssetiyaputra: Map method overwrites the original array? 00:31:09 Andrew Stimson: I had done a for loop 00:31:16 Andrew Stimson: instead of map :S 00:32:10 Pea: nodeList = object? 00:33:24 Pea: I did both of these: 00:33:25 Pea: console.log( linksArray.map( link => link.text ) ); console.log( linksArray.map( link => link.innerText ) ); 00:34:48 Pea: Yup 00:36:56 Robert Piper: function header( title ){ return `

${title}

`; } container.insertAdjacentHTML( `beforeend`, header(`My Header`) ) 00:37:13 Pea: ``` const subHeader = ( title = 'Default' ) => { return `

${title}

`; } const header = document.querySelector( 'h1' ); header.insertAdjacentHTML( 'afterend', subHeader() ); ``` 00:37:16 Luann Ebert: i used arrow since I’m trying to learn it 00:38:12 Pea: Right, but h2 comes after h1 00:39:53 Robert Piper: is there a resumeDefault() or so 00:45:17 Robert Piper: function logTitle( e ) { e.preventDefault(); console.log(e.innerText); } linksArray.map( link => link.addEventListener(`click`,logTitle )); 00:45:39 Robert Piper: I tryed it like this but log out an undefined 00:46:50 Zac Gordon: e.innerText 00:46:55 Zac Gordon: e.target.innerText 00:46:59 Zac Gordon: console.log(e) 00:47:08 Robert Piper: or this.innerText 00:54:16 Andrew Stimson: whoo hoo! Pseudo coding!!! Excited :)