+ 2
Please find the mistake of the wed program
2 Respuestas
+ 3
Your rev variable is not initialized so it takes undefind value so rev*10 is NaN. Assign to default value first rev=0;
In js division is float division operator
So 12/10=>1.2 , not 1 so apply Math.floor(12/10) method. For negetive values use Math.truncate().
No need to apply Number() for all operations. Just apply for input.
For just single comparision, better to use if-else over switch.
0
Use parseInt() instead of Number() inside while loop.