What Does It Do
Code It
Find the Error
Name that Event Listener
Miscellaneous
100

console.log("Hello")

displays hello on the console

100
Use console.log to print the number 10.

console.log("10");

100

console.log("Hi")

Missing semicolon

100

What is the event listener for allowing content to appear using a click of a button?

onclick();

100

Is an if statement a loop?

Yes

200

var x =5;

console.log(x);

displays 5 on the console

200

Create a variable with a value of 10. On a separate line, add 15 to this variable using assignment operators. Console.log the final variable.

<script>

var x = 10;

x += 15;

console.log(x);

</script>

200

variable x = 5;

Should be var instead of variable

200

What is the event listener for allowing content to appear with a hover from the mouse?

mouseover();
200

What is the length of the given string?

var string = "Hello World!"

The length of Hello World is 12 since the character includes the string.

300

var array=["apple", "pen", "applepen"];


console.log(array[1]);

displays pen in the console

300

Create a for loop that runs through the contents of an array and console.log each one.

var array = ["apples", "bananas", "oranges"];

for(var i = 0; i < array.length; i++){

console.log(array[i]);

}

300

var x = document.getElementByClassName("color");

Should be document.getElementsByClassName

300

What is the event listener for when a mouse hovers over a certain element and hovers off, a change occurs?

mouseout();

300

Part 1

How do you link a JavaScript file in the HTML?

Part 2

What tags do you use to put JavaScript in your HTML?

Part 1: <script src="filename.js"> 

Part 2: <script></script>

(Preferably outside the body tag)

400

<html><p class="text">words</p></html>

<script>

var words=document.getElementById("text");

words.innerHTML="words 2.0";

</script>

changes "words" to "words 2.0"

400

Add a new string to this array:

var array = ["red", "orange", "yellow"];

i.e.  array.push("green");

400

Two errors: 

var array = ("red, green, blue");
Should be brackets instead of parenthesis and there should be quotes for each item. 
400

What is the difference between onclick on click when used in an html file?

click is a function on HTML elements you can call to trigger their click handlers: element.click();.

onclick is a property that reflects the onclick attribute and allows you to attach a DOM handler to the element for when clicks occur.

400

What datatype is is being used when you make a store a class in a JS variable?


Array

500

<body><p class="words">hi</p> <p class="words">hello</p>

<p id="output"></p>

</body>

<script>var output=document.getElementById("output");

var text=document.getElementsByClassName("words");

for(var i=0; i<text.length; i++){

text[i].addEventListener("click", function(){

output.innerHTML="adios";

});

}</script>

Whenever you click the words "hello" or "hi", "adios" will pop up.

500

Create an onclick function called "change" that changes the text of a paragraph tag to "Web Development." and put it inside the paragraph tag.

<p id="text">Random Text</p>

<p id="text" onclick="change();">Random Text</p>

<script>

function change() {

var text = document.getElementbyID("text");

text.innerHTML = "Web Development";

}

500

Two errors: 


var i;
for (i == 0; i < 5; i+) {
  console.log("hello");
}

Should only be 1 equal sign, should be i++ for increment
500

Type the code with the function "myFunction" for a "click" event listener.

element.addEventListener("click", myFunction);

500

How do you change the color of something using JS?

element.style.color="colorname"