This symbol is used to select a class in CSS and jQuery.
What is "."?
The type of the variable "hello"
What is a string?
This is output to the console by console.log(false || true)
What is "true"?
Declare an array called "teachers" and include the names of all volunteer teachers in the class.
(answers will vary)
Example:
var teachers =["James","Tasha","Tommy","Angie"]
Write a function call to a function called onceUponATime with an argument of “Cinderella”
What is onceUponATime("Cinderella")?
These are the four elements of the box model.
What are margin, padding, border, and content?
"typeof(3.14)" will return this
What is number?
What is printed to the console by console.log((true && false || true) || (true && true || false));
What is "true"?
This is printed to the console
var donuts = ["vanilla", "chocolate", "strawberry”];
console.log(donuts.length)
What is 3?
List the parameter(s) in the following function.
function greeting(name1, name2){
$("p").text("Welcome " + name1 + "and " + name2);
}
name1
name2
This CSS rule makes it easier to design flexible responsive layout structure for webpages
What is "display:flex"?
The value of score in the following code?
var points = 5;
var bonus = 3;
var multiplier = 2;
var score = (points + bonus) * multiplier;
What is 16?
Write a conditional statement that checks if a variable called secretNumber is equal to a variable called myGuess.
if(secretNumber===myGuess){
//do something
} else{
//do someting else
}
How many elements are in the array “donuts” after the following code is run?
var donuts = ["vanilla", "chocolate", "strawberry”];
var faveFlavor = "glazed";
donuts.push(faveFlavor);
What is 4?
Declare a function called “triple” that accepts one number as an argument and returns 3 times that value.
function triple(num){
return num * 3;
}
Write a click handler to change the color of a page to aqua when the user clicks on a div with the class of "change".
$(".change").click(function)() {
$("body").css("background-color", "aqua");
});
The value of fullName in the following code:
var firstName = “Stephen”
var lastName = “Curry”
var fullName = lastName + “, “ + firstName
What is "Curry, Stephen"?
Write a program takes a number grade and converts it to a letter grade
Example: 90-100 → “A”, 80-89 → “B”, 70-79 → “C”, 60-69 → “D”, else “F”
(answers may vary here)
if (grade >= 90) {
result = "A";
} else if (grade >= 80) {
result = "B";
} else if (grade >= 70) {
result = "C";
} else if (grade >= 60) {
result = "D";
} else {
result = "F";
}
The index of "vanilla" in the following array:
var donuts = ["vanilla", "chocolate", "strawberry”];
What is 0?
Write a function named calculateArea that can calculate the area of a rectangle. It should have two parameters, length and width, and it should return the area of the rectangle.
function calculateArea(length, width) {
area = length * width;
return area;
}
Write a click handler that changes the text of a p tag with the id of "my-reply" to "Hello" when the user clicks a button.
$("button").click(function(){
$("#my-reply").text("Hello!");
});
Write a click handler that takes user input from a class “userName” and stores it in a variable called “user” when the user clicks a button
("button").click(function(){
var user = (".userName").val();
});
Write a compound conditional statement that checks if myNumber is between 10 and 20 or between 20 and 30. If the number is between 10 and 20, print "in the teens" to the console, if the number is between 20 and 30 print "in the twenties" to the console.
if(myNumber>10 && myNumber<20){
console.log("in the teens");
}else if(myNumber>20 && myNumber<30){
console.log("in the twenties");
}
Write a forEach loop that iterates over an array called “photos" and appends them to the page in an image tag in a div with a class of “container"
photos.forEach(function(photo){
$(".container").append("<img src=" + photo +">");
});
Write a function that takes an array as an argument and will print each array element to the body of the HTML page when the function is called.
function printArrayElements(array) {
array.forEach(function(element){
$("body").append(element);
});
}