JavaScript Data Type Conversion Flashcards

Learn about JavaScript data type conversion (7 cards)

1
Q

JavaScript is a dynamically typed language, what does this mean?

A

This means you don’t have to specify the data type of a variable when you declare it. It also means data types are converted as-needed during script execution.

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

How would you add a numeric value into a string?

A

You can add a numeric value into a string using the + operator.

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

What are the three ways to convert strings into numbers?

A

The three ways to convert strings to numbers are:
- parseInt()
- parseFloat()
- Number()

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

What does parseInt do?

A

The parseInt function converts its first argument to a string, parses that string and then returns an integer or NaN.

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

What parameters does parseInt accept?

A

parseInt accepts a string as its first parameter and radix as its second parameter.

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

What does parseFloat do?

A

parseFloat parses a string argument and returns a floating point number.

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

What does Number do?

A

Number converts the passed argument to a numeric value.

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