Class Number
Hierarchy
- Number
Index
Constructors
Methods
Constructors
constructor
Parameters
value: number
The numeric value of the number.
Optional unit: string
If passed, the number's unit.
Complex units can be represented as
<unit>*<unit>*.../<unit>*<unit>*...
, with numerator units on the left-hand side of the/
and denominator units on the right. A number with only numerator units may omit the/
and the units after it, and a number with only denominator units may be represented with no units before the/
.
Returns Number
Methods
get Unit
Returns a string representation of this number's units. Complex units are returned in the same format that constructor accepts them.
Returns string
get Value
Returns the value of the number, ignoring units.
⚠️ Heads up!
This means that
96px
and1in
will return different values, even though they represent the same length.Returns number
set Unit
Destructively modifies this number by setting its units to
unit
, independent of its numeric value. Complex units are specified in the same format as constructor.Parameters
unit: string
Returns void
set Value
Destructively modifies this number by setting its numeric value to
value
, independent of its units.Parameters
value: number
Returns void
Sass's number type.