Giter Site home page Giter Site logo

fewpjs-reviewing-dom-manipulation-quiz-re-coded-istanbul-2019's Introduction

Quiz: Reviewing DOM Manipulation

Answer the questions below using the following code example.

<body>
  <h1>List of pets ideal for city-dwellers</h1>
  <div>
    <ul>
      <li><span id="dog">Poodle</li>
      <li><span id="king-cobra">Nag</li>
      <li><span id="mongoose">Joe Mongoose</li>
   </ul>
  </div>
</body>

???

Reviewing DOM Manipulation

?: Which of the following declarations will create a variable whose content CANNOT be changed?

( ) var lunchOrder = "tofu" ( ) let lunchOrder = "soup" (X) const lunchOrder = "rock salt"

?: Given a method called razzle, how do you trigger its behavior?

( ) razzle ( ) razzle[] ( ) (razzle) (X) razzle()

?: In the HTML snippet above, select the JavaScript command that would select the node containing the text "Poodle."

( ) document.querySelector('.dog') ( ) document.querySelector('#king-cobra') (X) document.getElementById('dog') ( ) document.getElementById('#dog')

?: In the HTML snippet above, select the JavaScript command which would select all the <li> nodes.

( ) document.querySelector("li") (X) document.querySelectorAll("ul > li") ( ) document.querySelectorAll("ul") ( ) document.querySelector("span")

?: Which of the following JavaScript statements will change the text of the node with the id of "dog" to the text "Byron"?

( ) document.querySelectorAll("span[0]").textContent = "Byron"; ( ) document.querySelector("#li").innerHTML = "Byron"; (X) document.querySelector("#dog").textContent = "Byron"; ( ) document.getElementsByClass("span")[0].textContent = "Byron"

?: Talk about bad ideas, king cobras are not good pets. How can we remove the span with the id "king-cobra"?

( ) document.querySelector("span").delete("#king-cobra"); (X) el = document.querySelector("span#king-cobra"); y = el.parentNode; y.removeChild(el); ( ) el = document.querySelector("span#king-cobra"); y = el.parentNode(); y.removeChild(el); ( ) document.querySelector("ul").removeChild("span#king-cobra");

?: We’ve been inundated by cat owners who are angry that we have missed their favorite species of pet. What JavaScript snippet will add an li with a span inside with the text "Nancy Drew (the cat)" inside to our ul?

( ) document.getElementsByTagName("ul")[0] += "<li><span id=\"cat\">Nancy Drew (the cat)</span></li>"; ( ) ul = document.getElementsByTagName("ul")[0]; ul.innerText += "<li><span id=\"cat\">Nancy Drew (the cat)</span></li>"; (X)base = document.getElementsByTagName("li")[0].parentNode; item = document.createElement("li"); s = document.createElement("span"); s.id = "cat"; s.textContent = "Nancy Drew (the cat)"; item.appendChild(s); base.appendChild(item) ( )base = document.getElementsByTagName("li")[0].parentNode; item = document.createElement("li"); s = document.createElement("span#cat"); s.textContent = "Nancy Drew (the cat)"; item.addChild(s); base.addChild(item)

?: What JavaScript command would return the name of the mongoose?

( ) document.querySelectorAll("#mongoose").text; (X) document.querySelector("#mongoose").textContent; ( ) document.querySelector("#mongoose").text; ( ) document.querySelectorAll("#mongoose").content;

?: Which snippet correctly uses innerHTML to replace an HTML document’s body with a divcontaining an h1 with content "No Pets Allowed"?

( ) document.querySelector("#body").innerHTML = "<div><h1>No Pets Allowed</h1></div>" ( ) document.querySelector(".body").innerHTML = "<div><h1>No Pets Allowed</h1></div>" (X) document.querySelector("body").innerHTML = "<div><h1>No Pets Allowed</h1></div>" ( ) document.querySelectorAll(".body").innerHTML = "<div><h1>No Pets Allowed</h1></div>

?: Changing rendered text in the DOM with JavaScript changes the HTML source.

( ) True (X) False

???

fewpjs-reviewing-dom-manipulation-quiz-re-coded-istanbul-2019's People

Contributors

maxwellbenton avatar rrcobb avatar danielseehausen avatar jenmyers avatar drakeltheryuujin avatar

Watchers

James Cloos avatar Kevin McAlear avatar  avatar  avatar Victoria Thevenot avatar Belinda Black avatar Bernard Mordan avatar raza jafri avatar  avatar Joe Cardarelli avatar The Learn Team avatar Sophie DeBenedetto avatar  avatar Antoin avatar Alex Griffith avatar  avatar Amanda D'Avria avatar  avatar Nicole Kroese  avatar Kaeland Chatman avatar Joseph Kholodenko avatar Lisa Jiang avatar Vicki Aubin avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.