JavaScript Quiz Questions Flashcards
What is a variable?
Variables store data
Why are variables useful?
They are reusable and they can be reassigned later. They are also useful for readability
What two special characters can a variable begin with?
$ and _
How do you declare a variable?
By using the word var and giving it a name
How do you assign a value to a variable?
A variable is assigned with a “=”, which is a n assignment operator
Are variables case sensitive?
Yes
Which words cannot be used as variable names?
Keywords such as “var”, “function”, “true”, etc..
What is a string?
Data stored in ‘ ‘ or “ “
What is the string concatenation operator?
The addition operator/ +
What is the difference when it comes to using single quotes or double quotes ( ‘ ‘ or “ “ )?
There is no difference
How do you escape quotation characters?
With a backward slash \
What is type coercion?
When JavaScript converts data types behind the scenes to complete an operation
What is a number in JavaScript?
Numeric data type (primitive data type)
What is an arithmetic operator?
An operator that performs basic math
Name four of the arithmetic operators
+, -, *, /, –, ++, %
What is the order of execution?
Multiplication and division are performed before addition or subtraction. Parentheses overpowers everything.
What is a boolean?
A data type that only returns the values true or false
What is a comparison operator?
Compares two values and returns true or false
What is the difference between undefined and null?
The difference is when you declare a variable without giving it any value, the data type of that variable is undefined. Null on the other hand must be assigned programmatically. It represents the absence of value and usually a variable that is null, will have a value later on in the program.
Why is null an object?
It’s a bug
How do you think building this layout would be different without a grid system?
It would be a lot of elements with different sizings
What advantages do you see with using a grid system?
Helps size things quickly, readability, and for mobile responsiveness
Why are media queries crucial to responsive grid designs?
It helps with mobile responsiveness/ resizing for smaller or bigger screens
What is a function?
A reusable block of code with a series of statements grouped together to perform a specific task.