Module 04-04 Introduction to Javascript Flashcards

1
Q

What are the two words that can be used to declare a variable in JavaScript?

A

let (changeable) and const (immutable)

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

What does it mean that JavaScript is a loosely typed language?

A

It means that you don’t have to declare the datatype when initializing a variable

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

Can variables change datatypes in JavaScript?

A

Yes!

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

Does JavaScript use single or double quotes for strings?

A

Either, but it is best to use single

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

What method makes a string out of a number in JavaScript?

A

.toString()

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

How can you round to the nearest decimal point and convert to a string?

A

.toFixed(2) where 2 is the number of decimal points

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

How can you parse a string into a number?

A

.parseInt(string) or .parseFloat(string)

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

What is returned if a string can’t be parsed into a number?

A

NaN (not a number)

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

how is a placeholder represented?

A

${ }

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