Introduction to JavaScript Flashcards

1
Q

What is the console?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What does a semicolon do?

A

Indicates the end of a line or statement.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are the Primitive Data Types?

A

String, Number, Object, Boolean, Symbol, Null, Undefined

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is Math and name two methods you can call on Math.

A

Math is a built-in object.

  1. Math.floor(x) returns the largest integer less than or equal to x
  2. Math.random() returns a random number between 0 and 1.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Give two points about let

A
  1. You can declare a variable without assigning an initial value. The value will automatically be undefined.
  2. You can reassign the value of the variable
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Why would you want the ability to reassign values to a variable? For instance, why use let?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Give two points about const

A
  1. Const must be assigned a value when declared

2. Const variable cannot be reassigned

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

what does typeOf do?

A

Checks the data type of a variable’s value

How well did you know this?
1
Not at all
2
3
4
5
Perfectly