4.8.3 Critical Input Detail

I am trying to complete the code so it will produce the additional as a number and not a string. I am stuck on getting it to produce correctly. Not able to use type conversion to change the string values into numbers. Below is my code

const input = require(readline-sync);

let num1 = input.question("Enter a number: ");

let num2 = input.question("Enter another number: ");

console.log(number = num1 + num2);

1 Like

Sorry I have solved my issue. Thank you

I am having the exact issue, any chance you could share what worked for you? I cannot figure out how to use the type conversion for this question. I feel like I’ve put Number just about everywhere with no success. Thank you,

I have finally gotten this to work, here’s my solution:
let num1 = Number(input.question("Enter a number: "))

1 Like

console.log(number(num1) + number(num2));


Both the folks above gave you the correct direction!

Remember that user input will be always be entered as a string, so you have to do type conversion to turn it into a number and then do any operations on it.