JavaScript Flashcards
(101 cards)
What is a variable?
A way to hold data
Why are variables useful?
It can hold data that changes
What two special characters can a variable begin with?
dollar sign and underscore
How do you declare a variable?
Using the keyword “var”
How do you assign a value to a variable?
With the assignment operator “=”
Are variables case sensitive?
Yes
Which words cannot be used as variable names?
can’t start with a digit, no punctuation or special characters, keywords
What is a string?
datatype to represent text stored with quotation marks
What is the string concatenation operator?
+
What is the difference when it comes to using single quotes or double quotes ( ‘ ‘ or “ “ )?
No difference, but has to start and end with same quote
How do you escape quotation characters?
Backslash before the quote to let the interpreter know that it is part of the string instead the end of it.
What is type coercion?
JS will convert that value to the type it needs
What is a number in JavaScript?
Numeric Values
What is an arithmetic operator?
Operators can do math
Name four of the arithmetic operators?
+ (addition), - (subtraction), * (multiplication), / (division) %(remainder, modulus)
What is the order of execution?
By precedence - mult, div, comes first. Parenthesis overpowers everything.
What is a boolean?
data type that is true or false
What is a comparison operator?
> < and it returns a boolean
What is the difference between undefined and null?
undefined is an absence of a value, null is intentional absence of object value
What is a function?
group a series of statements together to perform a specific task
Why are functions useful?
reusable code
How do you call a function?
function name ( )
What are the parts of a function definition?
function keyword, function name, parameter, code block
What is the difference between a parameter and an argument?
declaring a function they are parameters and calling a function they are arguments