Conditionals
Loops
JavaScript1
HTML/CSS
Miscellaneous
100
What is the "not equal" operator? Hint: The "equal" operator is ===
!==
100
What does a while loop do?
Allows code to be executed repeatedly based on a given true/false condition. The while loop can be thought of as a repeating if statement.
100
How do you declare a variable in JavaScript?

var variableName;
100
What should be the first line of your HTML files?
1. <!doctype html>
2. <body>
3. <html>
4. <head>
1. <!doctype html>
100
In a CSS selector, how could you target an element that has id="example"?

HERE {
   width: 40px;
}
#example
200
What will this print?

var x = 25;
if(x < 10) {
    console.log("first");
} else if (x > 10) {
    console.log("second");
} else if (x === 25) {
    console.log("third");
} else {
    console.log("fourth");
}
second
200
What will this print?

    var num = 0;
    var i = 0;
    while(i < 4){
        num = num + i;
        i++;
    }
    alert(num);
6
200
List all of the JavaScript math operators you've learned and their names.
Addition +
Subtraction -
Multiplication *
Division /
Modulus %
200
Rewrite the following element so it has the class "largeImages"
<img src="someImage.jpg">
<img class="largeImages" src="someImage.jpg">
200
Give 2 ways to increment 1 to num on the next line after the comment.

   var num = Math.random();
   // Add 1 to num

num++

num = num + 1

num += 1

++num

300

What value could you set x to so "fourth" will be printed?

What value could you set x to so "third" will be printed?


if(x < 10) {
    console.log("first");
} else if (x > 10) {
    console.log("second");
} else if (x > 25) {
    console.log("third");
} else {
    console.log("fourth");
}
Setting x to 10 will print "fourth". There isn't a way to get "third" to print.
300
Write a while loop that console.log() the numbers 1-9.

  var i = 1;
  while(i < 10) {
     console.log(i);
     i++;
  }

300

  var x = 11;
  x = x + 3;
  console.log(x);
  x = 2;
What will console.log(x) output?
14
300
If we want to target a class with a CSS selector, the selector will have to start with this character.
. <-- a period
300
Name the 3 different types we've learned so far.
  • Strings
  • Numbers
  • Booleans
400
What will this print?

   var x = 3;
   if(x === "3") {
      console.log("true");
   }else{
      console.log("false");
   }
false
400
What will this print?

 var sum = 0;
 var i = 0;
 while(i < 5) { 
   sum = sum + i;
   i++;
 } 
 alert(sum);
10
400

  var x = 3;
  var y = 10;
  var xy = (x * y) /3;
What value does the variable xy hold?
10
400
Rewrite the following element so it has the ID "favClub"
<h1>ScriptEd</h1>
<h1 id="favClub">ScriptEd</h1>
400

Give 2 ways to comment out code.

Hint: One way comments out a single line, while the other way can be used to comment out multiple lines.


// This comments out one line of code

/* And this comments out
   multiples lines
   of code
*/
500
With conditionals, we're checking if something is true or false. We've learned 3 JavaScript types so far in this class. What JavaScript type is represents true or false?
boolean
500
Write an infinite while loop.

while(true) { }

500

  var s = "ScriptEd "; 
  var r = "Rocks!";
  var sr = s + r;
What is stored in variable sr?
"ScriptEd Rocks"
500
Given the following HTML, write a CSS rule that targets ONLY the second image and sets its width property to 200px.

<img class="largeImages" src="pic1.jpg">
<img class="largeImages" id="second" src="pic2.jpg">
<img id="third" src="pic3.jpg">

#second { width: 200px; }
500
What will this print?

var x = 1 + "2";
console.log(x);
12