Introduction to JavaScript Flashcards
What is the console?
It’s a panel that displays messages. A lot of our code is invisible to us by default so if we want to see things we can print or log to the console.
What does a semicolon do?
Indicates the end of a line or statement.
What are the Primitive Data Types?
String, Number, Object, Boolean, Symbol, Null, Undefined
What is Math and name two methods you can call on Math.
Math is a built-in object.
- Math.floor(x) returns the largest integer less than or equal to x
- Math.random() returns a random number between 0 and 1.
Give two points about let
- You can declare a variable without assigning an initial value. The value will automatically be undefined.
- You can reassign the value of the variable
Why would you want the ability to reassign values to a variable? For instance, why use let?
One example could be to update user input. Another example could be a quiz website. A user would start with 0 points, but end up with more so the need to continuously update/reassign values is essential.
Give two points about const
- Const must be assigned a value when declared
2. Const variable cannot be reassigned
what does typeOf do?
Checks the data type of a variable’s value