JavaScript Flashcards
What is a variable?
A variable is a container that stores data
Why are variables useful?
Variables can store data, and be used multiples times within code
What two special characters can a variable begin with?
$ and _
How do you declare a variable?
use the keyword “var”
How do you assign a value to a variable?
Use the “=”
Are variables case sensitive?
Yes
Which words cannot be used as variable names?
keywords such as function, console, etc
What is a string?
Form of data stored within quotation marks
What is the string concatenation operator?
’+’
What is the difference when it comes to using single or double quotes?
No difference
How do you use escape quotation characters?
need to put a “"
What is type coercion?
Type coercion is the process of converting one value to another type
What is a number in Javascript?
Any number
What is an arithmetic operator?
Any of the operators that perform arithmetic
Name four of the arithmetic operators:
- +
- -
- *
- /
What is the order of execution?
PEMDAS
What is a boolean?
A boolean is a primitive data type that is either true or false
What is a comparison operator?
it is the < or > sign (or the combined signs of ‘or equals to’)
What is the difference between undefined and null?
Undefined has yet to be defined, while null means that there is no value.
What is a function?
A function is a block of code that can perform a particular task.
Why are functions useful?
You can call the function to perform its needed task instead of writing the same code over and over
How do you call a function?
Write the function name, followed by ();
What are the parts of a function definition?
function keyword, function name (and parameters if needed), and the code block
What is the difference between a parameter and an argument?
Argument is the data you pass in, parameter is the data is that is declared when the function is defined