JavaScript Quiz Questions Flashcards
What is a variable?
A container for storing data
Why are variables useful?
You can reuse them, assign value to them, use for dynamic operations
What two special characters can a variable begin with?
A $sign or _underscore
How do you declare a variable?
The ‘var’ keyword
How do you assign a value to a variable?
with the equals sign
Are variables case sensitive?
Yes
Which words cannot be used as variable names?
other keywords in JS
What is a string?
A series of characters stored within a pair of “” marks
What is the string concatenation operator?
+ sign
What is the difference when it comes to using single quotes or double quotes ( ‘ ‘ or “ “ )?
No difference, but you can use apostrophes in “ “ double quotes.
How do you escape quotation characters?
With a backslash
What is type coercion?
The process of converting one data type value to another
What is a number in JavaScript?
a primitive datatype
What is an arithmetic operator?
operators that do math
Name four of the arithmetic operators?
+, -, *, /, %
What is the order of execution?
PEMDAS
What is a boolean?
A datatype with the values of true or false
What is a comparison operator?
Compares two values and returns a true or false value
What is the difference between undefined and null?
Undefined is a variable that has been declared but no value has been assigned.
Null must be assigned and is an empty value.
What advantages do you see with using a grid system?
Eliminates a lot of repetition, can be saved for later use,
More organized, and segmented.
Why are media queries crucial to responsive grid designs?
Allows for the page to be viewed on various device sizes so that nothing is cut out or removed due to sizing changes.
What is a function?
A list of actions to be performed
Why are functions useful?
Can be reused for multiple purposes, so they save a lot of time
How do you call a function?
name of the function with () parenthesis
What are the parts of a function definition?
function keyword, function definition (name) (parameters) {code}
What is the difference between a parameter and an argument?
Parameters are declared when the function is created
Arguments are the data you pass into the function
Why is it important to understand truthy and falsy values?
Can be important when using them in conditional statements or in comparisons, in case type coercion is used.
Why is the typeof null an object?
it is a bug
What is the difference between null and undefined?
Undefined is a declared variable that has not been assigned a value.
Null is an assigned empty value.
Undefined is a type, null is an object
Why do you always use === for comparisons?
because of type coercion, you might get an inaccurate result