Skip to main content

getUnit

Returns : String

Returns unit of a given string where the number comes first, then the unit.


Isolates the unit inside a string where the number is first, then the unit.

// returns the unit of a CSS valuegsap.utils.getUnit("50%"); // "%"gsap.utils.getUnit("100vw"); // "vw"

Parameters

  1. value : String - The value that you want the unit of.