JAVASCRIPT Flashcards
What is the purpose of variables?
To store data/values for the future
How do you declare a variable?
Using var with the equal sign followed by a value
How do you initialize (assign a value to) a variable?
By using the = operator
What characters are allowed in variable names?
Letters, numbers, $ and _
What does it mean to say that variable names are “case sensitive”?
The computer cannot read it
What is the purpose of a string?
For storing text that wouldn’t make sense to javascript
What is the purpose of a number?
Used to count
What is the purpose of a boolean?
Based on if its true and false, the computer will do this or that
What does the = operator mean in JavaScript?
to assign
How do you update the value of a variable?
variable name with a new value
What is the difference between null and undefined?
Null is assigned value and undefined has no assigned value but has been declared.
both are declared but undefined has no assigned value.
Why is it a good habit to include “labels” when you log values to the browser console?
Describes what you’re logging out, easier to read/understand
Give five examples of JavaScript primitives.
string, number, null, undefined, boolean
What is bigint
Bigger number
What data type is returned by an arithmetic operation?
numbers