JavaScript Fundamentals Flashcards
What is a variable?
A container to store information or data
Why are variables useful?
Can reuse them, assign value to them
Readability
What two special characters can a variable begin with?
$
_
How do you declare a variable?
var variableName;
How do you assign a value to a variable?
Using the assignment operator (=)
Are variables case sensitive?
Yes
Which words cannot be used as variable names?
Any JS keywords
What is a string?
Form of data stored inside quotation marks
What is the string concatenation operator?
+
What is the difference when it comes to using single quotes or double quotes ( ‘ ‘ or “ “ )?
There is no difference, but must be consistent and use only one kind
How do you escape quotation characters?
\
What is type coercion?
Automatic conversion of values from one data type to another
What is a number in JavaScript?
Any number (integer and floating point)
What is an arithmetic operator?
Mathematical operators that can be used to calculate numbers
Name four of the arithmetic operators.
Addition Subtraction Division Multiplication Increment Decrement Modulo
What is the order of execution? (reference to mathematical operators)
Multiplication and division will come before addition and subtraction UNLESS you place addition and subtraction inside parentheses
What is a boolean?
Datatype of true or false
What is a comparison operator?
Compares two values and returns a boolean
What is the difference between undefined and null?
Undefined - absence of value
Null - intentional absence of value
What is a function?
Set of instructions to complete a task, reusable
Why are functions useful?
Reusable, don’t need to repeat yourself
How do you call a function?
functionName(arguments);
What are the parts of a function definition?
function functionName(parameters) { // code block }
What is the difference between a parameter and an argument?
Parameter - variables when declaring a function
Argument - what you pass in when calling or invoking a function