+ 1
[SOLVED] What wrong
const fahTemp = eval(`(${secondInputValue} * 5/9) + 32`) What wrong with this line of code. It's says unexpected token '*' when i try in react
6 Antworten
0
I think that the problem comes from the type of secondInputValue, may you give its assignation code ?
0
VCoder i assigned it a value
0
Yes but how ? please, tell me the result of this line : console.log(typeof secondInputValue); //this line must come just before the assignation of celTemp
0
Yeah my bad. It's not assigned a value, because the first time page reload input field (secondInputValue) is empty
0
Already solved it
This is how i solved it:
const fahTemp = secondInputValue && eval(`(${secondInputValue} * 9/5) + 32`).toString()
Thanks fo help me figure out where is the problem
0
You're welcome !