+ 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

25th Dec 2021, 2:34 AM
EsaKurniawan
6 Respuestas
0
I think that the problem comes from the type of secondInputValue, may you give its assignation code ?
25th Dec 2021, 4:20 PM
VCoder
VCoder - avatar
0
VCoder i assigned it a value
26th Dec 2021, 12:37 AM
EsaKurniawan
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
26th Dec 2021, 12:45 AM
VCoder
VCoder - avatar
0
Yeah my bad. It's not assigned a value, because the first time page reload input field (secondInputValue) is empty
26th Dec 2021, 3:25 AM
EsaKurniawan
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
26th Dec 2021, 4:24 AM
EsaKurniawan
0
You're welcome !
26th Dec 2021, 3:33 PM
VCoder
VCoder - avatar