JavaScript Programmer’s Reference Example code: // Fuzzy matching (Msn web hosting)

JavaScript Programmer’s Reference Example code: // Fuzzy matching of numeric values function almost_equal(aValue1, aValue2) { var myPrecision = 1e-10; if((Math.abs(aValue1 aValue2)) < myPrecision) { return(true); } return(false); } See also: ASCII, Type conversion, typeof, Unicode Cross-references: ECMA 262 edition 2 section 11.9.1 ECMA 262 edition 3 section 11.9.1 Wrox Instant JavaScript page 36 Equality expression (Definition) An expression that tests for equality or not. Availability: Property/method value type: ECMAScript edition 2 Boolean primitive Equality expressions are a special case of Relational expressions. They deal strictly with equality or non-equality. There are two equality operators that you can use to make an equality expression: . The == operator tests for equality. . The != operator tests for inequality. As a general rule, equality expressions will yield a true or false result in a more forgiving way than relational expressions. Passing NaN, undefined and null values to relational expressions may yield undefined values as results, where an equality expression would still return a Boolean value. The comparisons between objects are likely to be a shallow comparison. If you are comparing two objects of the same type, the comparison logic will check to see if you are referring to the same instance. That is a test for identity and not equality. A deeper comparison might compare two similar objects on a property by property basis. They wouldn't be identical, but they may be equivalent. You could simulate this with a script function that returns trueor falsehaving done a deep comparison.
Note: If you are looking for best quality webspace to host and run your tomcat application check Vision personal web hosting services

Leave a Reply