WorksheetsJavaScript Variables Quiz
Total questions: 26
Worksheet time: 22mins
Show Me What You Got! How do you declare a variable in JavaScript?
let
function
var
variable
Show Me What You Got! What are the different types of values that a variable in JavaScript can represent?
apple, banana, orange, grape
cat, dog, bird, fish
red, blue, green, yellow
string, number, boolean, object, function, undefined
Show Me What You Got! Is JavaScript attentive to the way we dress up variable names, paying attention to uppercase and lowercase letters?
No
Yes
Sometimes
Only on weekends
Show Me What You Got! You're creating a new variable in JavaScript for your intergalactic DJ app. What rules must you follow for naming it?
Variable names must begin with a letter, underscore (_), or dollar sign ($)
Variable names must begin with a special character
Variable names must begin with a number
Variable names must begin with a hyphen
Show Me What You Got! Imagine you're a developer working on a JavaScript project. You declare a variable but forget to assign it any value. What does JavaScript default this variable to?
undefined
false
0
null
Show Me What You Got! Explain the difference between 'let', 'var', and 'const' in JavaScript variable declaration.
They are all used for declaring global variables only
They have different scopes and usage in JavaScript.
They are all the same and can be used interchangeably
They are all outdated and not recommended for modern JavaScript development
Show Me What You Got! Can a variable name in JavaScript be initiated with a digit?
Yes
Maybe
Only on Tuesdays
No
Show Me What You Got! Why do we use camelCase or snake_case when naming variables in JavaScript?
To add unnecessary complexity to the code
To make variable names more readable and understandable.
To make the code run faster
To confuse other programmers
Show Me What You Got! Imagine you're coding a new feature in JavaScript and you declare a variable using 'let' inside a for-loop. What's the scope of this variable?
Global scope
Function scope
Class scope
Block scope
What is the variable in 3x - 5
x
5
3
What are the variables in 3x + y
3x
x,y
x
y
True or False: _Mondaylunch
is proper naming convention
True
False
True or False: Var good Day;
is a proper naming for variables
True
False
True or False: SummerTime
Is a proper naming convention
True
False
True or False: $today_Scoer
is a proper naming convention
True
False
Number, Boolean, String; are basic what?
Data Types
Data
Variables
Variable data
What keyword do you need to use to define a variable in JavaScript?
X
Variable
int
Var
What is the ID this variable is referencing?
var mainB = document.getElementById("mainButton");
var
document
mainButton
mainB
What is Top Down Design?
Starting with the most specific problems and then working up to solve the big problem
Working from the top of your program and coding down to the bottom
Starting with the biggest problem and then working down to solve the more specific problems
Implementing all of the functions first, then putting them together in the start function
