0

I got a simple javascript function in my asp.net page that just checks to see if one value is smaller than the other. The condition value is 15000.00 and i'm comparing it to 920.00

Why does it evaluate to false?

var moo= 15000.00;
var orig= 920.00;
var bool = orig < moo;

if (bool) {
...some code here...
}

Note that this also doesn't work:

if (orig < moo) {
...some code here...
}

Edited by phoenix_dwarf: Misspelt a word...

2
Contributors
5
Replies
6
Views
7 Years
Discussion Span
Last Post by phoenix_dwarf
0

I got a simple javascript function in my asp.net page that just checks to see if one value is smaller than the other. The condition value is 15000.00 and i'm comparing it to 920.00

Why does it evaluate to false?

var moo= 15000.00;
var orig= 920.00;
var bool = orig < moo;

if (bool) {
...some code here...
}

Note that this also doesn't work:

if (orig < moo) {
...some code here...
}

Well, no idea but using it like this for now...

var moo= 15000.00;
var orig= 920.00;
var bool = moo / orig;

if (bool >= 1) {
...some code here...
}
0

why not try this:

var moo= 15000.00;
var orig= 920.00;
var bool = orig - moo;

if (bool < 0) {
...some code here...
}
0

why not try this:

var moo= 15000.00;
var orig= 920.00;
var bool = orig - moo;

if (bool < 0) {
...some code here...
}

Thnx for quick reply. But it's all the same to me now. Except if the subtraction calculation has performance advantages???

0

none really , did you try removing the var declaration ?

Which var declaration? No not that i can remember but it works great for now. Tnx

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.