Math.toBeCloseTo

toBeCloseTo(expected: number, actual: number, precision: number) → {boolean}

check if the given value is close to the expected one

// test if the given value is close to 10
if (me.Math.toBeCloseTo(10, value)) {
    // do something
}
Parameters:
Name Type Attributes Default Description
expected number

value to be compared with.

actual number

actual value to compare

precision number

<optional>

2

float precision for the comparison

Returns:
Type Description
boolean

if close to

Powered by webdoc!