The parse() static method of the CSSNumericValue interface converts a value string into an object whose members are value and the units.
Note: This method cannot be called in Worker or Worklet contexts — parsing CSS text is restricted to the main thread. All other methods in the CSSNumericValue interface are available in workers and worklets.
CSSNumericValue.parse(cssText)cssTexta string containing numeric and unit parts.
SyntaxError DOMExceptionTBD
The following code returns a CSSUnitValue object with a unit property equal to "px" and a value property equal to 42.
let numValue = CSSNumericValue.parse("42.0px");