JS Flashcards
What is a variable?
JS variables are containers for storing data values.
Why are variables useful?
Because we can change the value of a variable and can reuse them as well. Also useful for readability!
What two special characters can a variable begin with?
$ and _
How do you declare a variable?
You can do: var variable name
How do you assign a value to a variable?
variable name = value you want to assign
Are variables case sensitive?
Yes
Which words cannot be used as variable names?
reserved words (JS keywords)
What is a string?
A JS String stores a series of characters like “Tia Kim”.
What is the string concatenation operator?
It produces a new string by appending the second operand onto the end of the first operand.
What is the difference when it comes to using single quotes or double quotes ( ‘ ‘ or “ “ )?
No difference.
How do you escape quotation characters?
You can use \ to escape quotation characters.
What is type coercion?
Type coercion is the process of converting value from one type to another.
What is a number in JavaScript?
It represents and manipulate numbers.
What is an arithmetic operator?
It takes numerical values as their operands and return a single numerical value.
Name four of the arithmetic operators?
+, -, /, *
What is the order of execution?
Multiplication and division are performed before addition or subtraction.
What is a boolean?
Boolean is a data type that returns either true or false.
What is a comparison operator?
A comparison operator compares its operands and returns a Boolean value based on whether the comparison is true.
What is the difference between undefined and null?
Undefined is a type and null is an object.
What advantages do you see with using a grid system?
Easier to stay organized with the layout,
mobile responsiveness, consistency, etc.
What is a function?
A function is a block of code that performs a particular task.
Why are functions useful?
Because you can use it multiple times with different arguments.
How do you call a function?
With its name followed by parentheses.
What are the parts of a function definition?
Function keyword, function name, code block.
Parameters vs arguments
Parameters are the names listed in the function definition and arguments are the real values that are passed to the function.
Why is it important to understand truthy and falsy values?
Because it is important when writing conditional statements in code.