Main deck Flashcards
What are “var, let, const”?
Declaration Keywords
What does var do?
Declares a variable of global scope
What does let do?
Declares a variable of block scope
What does const
do?
Declares a variable that cannot be reassigned.
What does it mean to “declare a variable”?
It means telling the computer to open a slot in memory where it can place a value in the future.
What can be stored in a variable?
Any “value” - numbers, strings, booleans, objects, etc.
What are the 5 basic (or “primitive”) data types?
Number, string, boolean, undefined, null
What’s the difference between ‘5’ and 5?
The first one is a string and the second one is a number.
What does var x = 5
do?
Declares a variable called x and assigns the value 5 to it.
Are semicolons required in javascript?
No but it’s a good idea to use them.
What should the file extension be for a javascript file?
.js
How do you get to a javascript console in terminal?
node
What are the boolean values?
true and false
What does (5+2) resolve to?
10
What is the operator =
called?
The assignment operator
What does the operator =
do?
Assigns the value on the right to the variable on the left.
What are all these called: =
, +
, -
, ==
, %
, !
, !=
Operators
What category of operators are all these: ==
, &&;&&;
, ||
, !=
Boolean operators
What is the operator ==
called?
The comparison operator
What does the operator ==
do?
Compares both sides and returns true if they are equal (but not necessarily the same type).
What is the operator ===
called?
“True equals” or “strict comparison” operator.
What does the operator ===
do?
Compares both sides and returns true if they are equal (AND the same type!).
What does the operator !=
do?
Returns true if the two sides are NOT equal.
What is the operator !
called?
The negation operator (often called “NOT”).
What does the operator !
do?
Flips (“negates”) the boolean value…true turns to false and false turns to true.
What does !!true && true
resolve to?
true