T
transkawa
why do i get different results for this two logical connectives:
1. while( !filterGuess(guess,y)) //i.e when false
2. while( filterGuess(guess,y) == 'false')
as for 2, i got the wrong result. i tried type equality checking, ===,
and still got the same wrong result for 2.
please, can someone help me explain why i got wrong result for 2 but 1
returned the right response?
the filter function is:
function filterGuess(guess,y){
return (!(Math.abs(guess - y) > 0.00001)); //returns true if within
tolerance
}
TIA.
xnt
1. while( !filterGuess(guess,y)) //i.e when false
2. while( filterGuess(guess,y) == 'false')
as for 2, i got the wrong result. i tried type equality checking, ===,
and still got the same wrong result for 2.
please, can someone help me explain why i got wrong result for 2 but 1
returned the right response?
the filter function is:
function filterGuess(guess,y){
return (!(Math.abs(guess - y) > 0.00001)); //returns true if within
tolerance
}
TIA.
xnt