Variables & Data Types
Strings
Functions
Conditions
Operators
100

What keyword should you use for a variable that will never be reassigned?

const

100

What property tells you the number of characters in a string?

.length

100

What keyword is used to define a function in JavaScript?

function

100

What keyword starts a conditional statement in JavaScript?

if

100

Which comparison operator checks both value and type?

===

200

Give one valid JavaScript variable name that follows camel case rules.

myVariableName

200

Which method checks if a string starts with certain text?

.startsWith()

200

What are values placed inside a function’s parentheses when calling it called?

Arguments

200

Which statement is best for checking one value against many fixed options?

switch statement

200

What does true && false evaluate to?

false

300

What does the += operator do to a variable’s value?

Adds to its current value.

300

What is the difference between .substring() and .slice()?

.slice() allows negative indexes; .substring() does not.

300

What does the return keyword do in a function?

Sends a value back to where the function was called.

300

What does the ternary operator (? :) do?

Acts as a shorthand for if/else in assignments

300

Which logical operator returns true if at least one condition is true?

|| (OR)

400

Which characters are allowed in JavaScript variable names (excluding the first character rule)?


Letters, numbers, _, and $

400

What will "Hello" + 5 return in JavaScript?

"Hello5" (string concatenation)

400

What is the difference between local and global variables?

Local variables exist only inside a function; global variables are accessible anywhere.

400

What is the result of isNaN("Hello")?

true

400

What is the result of 5 != "5" in JavaScript?

false

500

What happens if you try to use a variable that has been declared but not assigned a value?

It has the value undefined.

500

What method would you use to find the position of "cat" in "The cat sat"?

.indexOf("cat")

500

Write a function header for a function named add that takes two parameters, x and y.

function add(x, y) { }

500

Write a simple if statement that checks if score is greater than or equal to 90.

if (score >= 90) {

  // code

}


500

What does the ! operator do to a Boolean value?

Reverses it (true becomes false, false becomes true).