Q
Which method can be used to convert a string to a number in JavaScript?

Answer & Solution

Answer: Option A
Solution:
The parseInt() function parses a string argument and returns an integer.
Related Questions on Average

What is the output of typeof null?

A). null

B). undefined

C). object

D). number

What is the result of typeof Symbol('id')?

A). symbol

B). object

C). string

D). undefined

Which function can convert a number to a string in JavaScript?

A). toString()

B). parseInt()

C). String()

D). Number()

What is the data type of true in JavaScript?

A). String

B). Boolean

C). Number

D). Object

What is the output of '5' + 3?

A). 8

B). 53

C). 8

D). Error

What is the result of null === undefined?

A). 1

B). 0

C). Error

D). NaN

What will typeof [1, 2, 3] return?

A). array

B). object

C). number

D). list

Which operator checks both value and type for equality in JavaScript?

A). ==

B). !=

C). ===

D). !==

What is the data type of an array in JavaScript?

A). Array

B). Object

C). Collection

D). List

What will typeof NaN return?

A). number

B). NaN

C). undefined

D). object