Intro to JavaScript Flashcards
(65 cards)
What is console?
A keyword that refers to an object, a collection of data and actions.
What is a keyword?
Words that are built into the JavaScript language so the computer will recognize them and treats them specifically.
How to use .log()
console.log() - what is put in the parenthesis will get printed/logged in the console.
What are the 7 fundamental data types?
Number, String, Boolean, Null, Undefined, Symbol, Object
What is an undefined data type?
It represents the absence of a value though it has a different use than NULL
What is a symbol data type?
Unique identifiers, useful in more complex coding.
What is an object data type?
Collections of related data.
Are number data types allowed decimals?
Yes
What is a variable?
You can think of a variable as a container for a value.
What are the few things you can do with variables?
- Create a variable with a descriptive name
- Store or update information stored in a variable
- Reference or “get” information stored in a variable
What does var do?
Keyword that creates, or declares, a new variable.
What are rules of naming variables?
- Variable names cannot start with numbers
- Variable names are case sensitive
- Variable names cannot be the same as keywords
What does the let keyword allow for?
This keyword signals that the variable can be reassigned a different value.
What value does a var have if we initiate it without a value?
Undefined
What does the const keyword do?
Create a variable that cannot be reassigned. These must be assigned a variable when they are declared.
What is a template literal?
A function(?) that lets you add variables into strings. Must use ~ instead of '.
Give an example of a template litera?
console.log(My name is ${variable}
)
Example of an if statement
if (false) {
console.log(‘The code in this block will not run.’);
What operator do you use to say “Is equal to”?
===
What operator do you use to say “Is not equal to”?
!==
What does the and operator look like?
&&
What does the or operator look like?
||
What does the not operator look like?
!
Which values are falsy or evaluate to falsy?
0, Empty strings like “” or ‘’, null, undefined, Nan