Holds a ratio in the form of (n:m).
Can be used to define the scale factor in certain situations. The numerator and denominator are stored as assigned and are not reduced.
new Ratio(
numerator?,denominator?):Ratio
Creates a ratio.
If no arguments are provided, the ratio is initialized as (1:1). Passing 0 as numerator is allowed but usually does not make practical sense. The constructor throws a RangeError if denominator is 0.
number
Numerator of the ratio.
number
Denominator of the ratio.
Ratio
get denominator():
number
Returns the denominator of the ratio (that is, m from (n:m)).
number
set denominator(
denominator):void
Sets the denominator of the ratio (that is, m from (n:m)).
The setter throws a RangeError if denominator is 0.
number
Denominator of the ratio.
void
get numerator():
number
Returns the numerator of the ratio (that is, n from (n:m)).
number
set numerator(
numerator):void
Sets the numerator of the ratio (that is, n from (n:m)).
Passing 0 is allowed but usually does not make practical sense.
number
Numerator of the ratio.
void
clone():
Ratio
Creates a copy of the ratio.
Ratio
copy(
other):this
Copies numerator and denominator from another ratio.
Ratio
Ratio to copy.
this
toNumber():
number
Converts the ratio to a numeric value.
number