Data Types
If/Else
Arrays
Loops
Objects
100

What key word is used to create a variable in JavaScript?

var
100
What is the structure of a proper if statement (with no else if or else)

if (condition) {

code

}

100

How do I declare an empty array named 'arr'

var arr = []

100

What are the two types of loops that we learned about?

For, while
100

Name one of the object animals your classmates created (cannot be your own)

Elephant cat, flying shark, Lola, PENUT, eye spring

200

How do you get the length of a string?

.length

200

What is the name of a variable that can only take the values true or false

boolean

200

How do I get the element "code" out of the array:

arr = ["learning", "to", "code", "is", "fun!"]

arr[2]

200

Why do we use loops?

lots of correct answers

200

How do I check what the name attribute of the object named myElephantCat is?

300

Name 2 types of data in Javascript

Number, string, boolean, array, object

300

What symbol(s) can I use to return true if ONE or BOTH boolean expressions are true, and false otherwise? ex. expr1 __ expr2

||

300

How do I add the item 2 to the array

arr =[1, 3, 1]

arr.push(2)

other acceptable answers

300

Fill in the blanks to declare a for loop that runs 20 times

for (let ____; ____; ____) {

...

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

(multiple correct answers)

300

Set the 'color' attribute of the object myAnimal to 'green'

myAnimal.color = 'green'

400

What is the index of the "w" in "Hello world!"

6

400

What will the following statement print?

If (true || false) {print("Hello ")}

If (true && false) {print("World")}

else {print("!")}

Hello!

400

Name one way to remove an element from an array

.pop(), .shift(), .slice()

400

How might I create an infinite loop

ex. while(true)

400

Declare a new object stored in the variable 'myObject' with the attribute size that takes the value 100

var myObject = {

size: 100

}

500

What function call would I use to get only the "love" out of var s = "I love Javascript!"

s.slice(2, 6)

500

What will x be equal to at the end of this statement?

x = ""

if (x) {x += "Python"}

if (!x) {x += "JavaScript"}

if (x.length > 6) {x += " is the best"}

else if (x.length < 100) {x += " is the worst"}

else {x += "!"}

JavaScript is the best

500

how might I combine the following arrays into a single array with all of the names?

var names1 = [“Jennie”, “Rose”]

var names2 = [“Jisoo”, “Lisa”]

var allNames = names1.concat(names2)

500

Write a loop that adds up every element in an array of numbers 'arr' and stores it in the variable sum. Start with:

sum = 0

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


}

sum = 0

for (let i = 0; i < arr.length; i++) {

sum += arr[i]

}

500

Why do we use objects in JavaScript? (Has to be a really good answer for 500 points!)

Answers will vary