jacob-on-stackoverflow jacob-on-stackoverflow - 1 year ago 84
AngularJS Question

Why does JavaScript get this comparison wrong?

This is happening on an angular application I'm building. If a user enters 80 into an HTML input, it always seems to get this comparison wrong.

var x = '80';
var y = 150.9800;

/* Returns incorrect answer */
if (parceFloat(x) < y) {
return true;
} else {
return false;

Answer Source

parceFloat() is not a function, the function is parseFloat()

A simple typo is all the error there is.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download