Skip to content

Latest commit

 

History

History
executable file
·
26 lines (25 loc) · 1.22 KB

w02d1.md

File metadata and controls

executable file
·
26 lines (25 loc) · 1.22 KB

w02d1

  1. What is DOM?
  2. Why do we need it?
  3. What is the major difference between document.getElementsByClassName("some-class") and document.getElementById("some-id") in terms of what it returns?
  4. Answer the following questions using this HTML
  <body>
    <div>
      <ul>
        <li class="item">a</li>
        <li class="item">b</li>
        <li class="item">c</li>
        <li class="item">d</li>
        <li class="item">e</li>
      </ul>
    </div>
  </body>
  1. How do we target all the <li>?
  2. How do we target even <li>s? (b,d)
  3. How do we give each <li> an attribute call "my-value" that contain the innerHTML as it's value?
  4. Add a button with an event listener when clicked to each <li> to console.log it's attribute "my-value's" value.
  5. How do we change google's "I'm Feeling Lucky" to "I am Feeling Awesome" with javascript? (test it in the chrome developers tool console!)
  6. What's the difference between == and === in javascript? Please provide an example in which they return different values?
  7. Imagine we need to store all students and grades for the morning assessment in javascript. What would be a good data structure to store this information? Please justify your answer