Conditional Logic
What does this JavaScript do?
HTML & CSS Concepts
Fill in the blanks
JavaScript Concepts
100

Name the values of X for which this condition is true:

(X === 4 || X === 3)

|| means or, by the way

3 or 4

100

for (let i = 0; i < 10; i++) {

console.log(i);

}

0

1

2

3

4

5

6

7

8

9

100

What does this display?

<button>Click me</button>

A button which says Click me

100

Fill in the blank to make this code check if someone is under 18:

if (age __ 18) {

}

<

100

What is a variable?

An identifier that leads to a space in memory where some data is stored.

200

Name the values of X for which this condition is false:

(X === 5 || X === 6)


|| means or

X != 5 and X != 6

200

let main = document.getElementById("mainheader");

Stores in the variable main the HTML element with an id of mainheader.

200

On what HTML elements will this CSS styling be applied?

p {

color: blue;

}

All paragraph (p) elements

200

Fill in the blanks to make this function add the two numbers it is given.

function add(a,b) {

    return a _ b;

}

+

200

Which of these is a function?

A: name

B: [1,2,3,4]

C: checkWin()

D: "Hello"

C: checkWin()

300

Condense this to a single condition:

(Y > 4 || Y === 4)

|| means or

Y >= 4

300

infoheader.innerHTML = "Not enough socks.";

Sets the HTML element stored in infoheader to say "Not enough socks."

300

On what HTML elements will this CSS styling be applied?

.image-caption {

font-family: serif;

}

All elements with a class of image-caption (such as <p class="image-caption"> HI I am a paragraph </p>)

300

Fill in the blanks to make this code run only if the person is not named Pepe. 

if (name __ "Pepe") {

    console.log("Hi not Pepe");

}

!=

300

What is a list and how are its items accessed? 

A series of related variables, all stored under one name.

The items are accessed using indexes that start at 0 and go up to n-1 where n is the length of the list. 

e.g. names[3] 


400

Name all values of Y for which this condition is false:

(Y > 3 && Y != 7)

&& means and

Y <= 3, Y = 7

400

for (let i = 0; i < 10; i = i*i) {

console.log(i);

}

Prints 0 endlessly and crashes Chrome. 

400

What are the three modifications this CSS will apply to all h1 elements?

h1 {

color: rebeccapurple;

font-family: cursive;

font-size: 30px;

}

Change color to purple, change font to cursive, change size to 30 pixels

400

Fill in the blanks to print every other element in the list words. (So it should print "never give up"). 

words = ["never", "gonna", "give", "you", "up"];

for (let i = 0; i < 5; i = __) {

     console.log(words[i]);

}

i + 2

400

How do I print something to the console AND where do I find the console? 

1) console.log()

2) Inspect element, then "Console"

500

Condense this into a single condition:

(Y < 4 || Y > 4)


|| means or

Y != 4

500

let funlist = [1,2,3,4,6,42,4];

for (let i = 0; i < 7; i++) {

console.log(funlist[i]);

}

Prints to the console:
1

2

3

4

6

42

4

500

What happens when this button is clicked? be specific :>

<button onclick="checkAnswer()">Submit Answer</button>

A JavaScript function will run called checkAnswer()

500

Fill in the blanks to make this code run while i is less than 6. (You may not have seen this structure before, but you should still be able to work it out). 

let i = 0;

while (_ _ _) {

    console.log(i);

    i = i + 1;

}

i < 6

500

What is the document AND name one function that belongs to it

The document is the HTML webpage itself

Functions: getElementById, getElementsByClassName, etc (any valid response)

M
e
n
u