OriginCodeAcademy / Cohort10

Projects, code tests and resources for the 10th cohort of Origin Code Academy
4 stars 2 forks source link

02-CodePen-VanillaJS #127

Closed Blacoste264 closed 7 years ago

Blacoste264 commented 7 years ago

Pen #1: http://codepen.io/blacoste264/pen/gWrXWZ Pen #2: http://codepen.io/blacoste264/pen/mmEJbP Pen #3: https://codepen.io/blacoste264/pen/gWMrVe

P#1 ?'s:

  1. What is the function of document.getElementById()? Accessing element of DOM by specific ID

  2. What happens if you remove e.preventDefault() on line 18 and return false on line 37? (Delete these lines and play around with the app) Why does this happen? (Search 'e.preventDefault form' on Google)

  3. How do you grab the value of an input element using JavaScript? document.getElementByTagName("input");

  4. How do you set the innerHTML of a p element using JavaScript? document.getElementByTagName("p").innerHTML;

P#2 ?'s:

  1. What is the function of appendChild()? Add to bottom of whichever element you select.

  2. What is the function of createElement()? Create a new element in your HTML (ex. a list appearing when certain button is pushed and input is received.)

  3. What is the function of createTextNode()? Create new text inside the HTML.

  4. How would you go about implementing a remove todo feature? To add a delete button to a to-do item, modify the code that generates the elements that represent each to-do item. Create a button in HTML, and a function in JS.

P#3 ?'s:

  1. What is the function of document.getElementsByTagName? Retrieve lists, body, inputs etc.

  2. What is the purpose of the .reduce function? Taking an array or given set of values and basically "reducing" it into a variable or "total"

  1. What is the purpose of the setAttribute method? The setAttribute() method adds the specified attribute to an element, and gives it the specified value.
seancahall commented 7 years ago

Good work!