Name the values of X for which this condition is true:
(X === 4 || X === 3)
|| means or, by the way
3 or 4
for (let i = 0; i < 10; i++) {
console.log(i);
}
0
1
2
3
4
5
6
7
8
9
What does this display?
<button>Click me</button>
A button which says Click me
Fill in the blank to make this code check if someone is under 18:
if (age __ 18) {
}
<
What is a variable?
An identifier that leads to a space in memory where some data is stored.
Name the values of X for which this condition is false:
(X === 5 || X === 6)
|| means or
X != 5 and X != 6
let main = document.getElementById("mainheader");
Stores in the variable main the HTML element with an id of mainheader.
On what HTML elements will this CSS styling be applied?
p {
color: blue;
}
All paragraph (p) elements
Fill in the blanks to make this function add the two numbers it is given.
function add(a,b) {
return a _ b;
}
+
Which of these is a function?
A: name
B: [1,2,3,4]
C: checkWin()
D: "Hello"
C: checkWin()
Condense this to a single condition:
(Y > 4 || Y === 4)
|| means or
Y >= 4
infoheader.innerHTML = "Not enough socks.";
Sets the HTML element stored in infoheader to say "Not enough socks."
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>)
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");
}
!=
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]
Name all values of Y for which this condition is false:
(Y > 3 && Y != 7)
&& means and
Y <= 3, Y = 7
for (let i = 0; i < 10; i = i*i) {
console.log(i);
}
Prints 0 endlessly and crashes Chrome.
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
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
How do I print something to the console AND where do I find the console?
2) Inspect element, then "Console"
Condense this into a single condition:
(Y < 4 || Y > 4)
|| means or
Y != 4
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
What happens when this button is clicked? be specific :>
<button onclick="checkAnswer()">Submit Answer</button>
A JavaScript function will run called checkAnswer()
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
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)