javascript - Why does it keep adding a random 0? -


I was trying to create an MCT calculator in JavaScript, though during the construction of the mean, I received errors having had. This is my code: (Note that I am relatively new to javascript)

  var min = prompt ("Enter the minimum value"); Var max = Prompt ("Enter Maximum Price"); If (min> max) {warnings ("Error: \ n \ n \ nminimum value '" + + + "maximum value greater than" "+ max +"'); } And {var a = (max - min); Warning ("variable one is" + max + "-" + minute + "=" + a); Var B = A / 2; Warning ("variable is b" + a + "/ 2 =" + b); Var c = min + b; Warning ("variable is" + minute + "+" + b + "=" + c); Warning ("range is + + + \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \" + + + \ n \ n Median + "+ + +" + \ n \ n max "max +" \ n \ n Max is "max");  
< P> If you type 10 for the minimum value and 10 for the maximum value, then it will tell you that 5 is greater than 10 but this is not .. And if you type 10 for the minimum value and maximum value For 15, the average should be 102.5 instead of 12.5. I do not get it at all, please help :)

Use the numbers Try it, try not to string:

  var min = parseInt (prompt ("enter minimum value"), 10); var max = parseInt (prompt ("Enter maximum value") ,  

Or, if you want to allow floats: ); Var max = parseFloat (Prompt "Enter Maximum Price");

This is because stringics are compared to Lichxography, because instead of the value of the number Use Nkyatmk character code.


Comments

Popular posts from this blog

Editing Python Class in Shell and SQLAlchemy -

import - Python ImportError: No module named wmi -

uislider - In a MATLAB GUI, how does one implement a continuously varying slider from a GUIDE created .m file? -