Exam4Training

Which code assignment shows a correct way to convert this string to an integer?

Refer to the code below:

Let textValue = ’1984’;

Which code assignment shows a correct way to convert this string to an integer?
A . let numberValue = Number(textValue);
B . Let numberValue = (Number)textValue;
C . Let numberValue = textValue.toInteger();
D . Let numberValue = Integer(textValue);

Answer: A

Exit mobile version