JS Flashcards
Why are variables useful?
Save data and return to it
What two special characters can a variable begin with?
$ _
How do you declare a variable?
var
How do you assign a value to a variable?
the assignment operator (=)
Are variables case sensitive?
yes
Which words cannot be used as variable names?
keywords, cant start with numbers
What is a string?
data type of text
What is the string concatenation operator?
+
What is the difference when it comes to using single quotes or double quotes ( ‘ ‘ or “ “ )?
nothing
How do you escape quotation characters?
/”
What is type coercion?
a different data type becoming a string only because it was concatenated with a string
What is a number in JavaScript?
a number
What is an arithmetic operator?
+, -, *, etc.
Name four of the arithmetic operators?
+, -, *,/
What is the order of execution?
PEMDAS
What is a boolean?
a data type of true and false values
What is a comparison operator?
an operator that compares variables and returns a boolean value accordingly
What is the difference between undefined and null?
undefined is an empty variable argument while null is an argument with a specified value of emptiness. A human must specify a null value.
What is a function?
Functions group statements together to perform a task.
Why are functions useful?
Functions enable the reuse of these specific groupings of statements in the future as opposed to recreating matching code for different arguments.
How do you call a function?
functionName(arguments)
What are the parts of a function definition?
function Name(parameters) { return code block }
What is the difference between a parameter and an argument?
a parameter is the required information needed in order to call a function while an argument are the actual values being passed to the function upon its calling
Does the default case have to be at the bottom of the switch statement?
Nope, but should be
What is an object in JavaScript?
its a reference data type that contains properties and methods
How do you create an object literal?
var name = {};
When should you use bracket notation over dot notation with objects?
when you only want to target properties and not methods
How do you remove a property from an object?
delete object
What is an array in JavaScript?
objects are storage area, arrays are for lists to loop through usually
How do you create an array literal?
var name = []