Some languages read right-to-left (rtl), so their "right" is the start and not the end.
So if you're trying to remove from the beginning of the input, regardless of the language used, using trimStart is more appropriate than trimLeft.
CSS has provided properties that consider the same use case, called "logical properties". So for example, margin-top, margin-right, margin-bottom, margin-left, can also be written as (respectively): margin-block-start, margin-inline-end, margin-block-end, margin-inline-start.
What's the difference between
trimStart
andtrimLeft
?Some languages read right-to-left (
rtl
), so their "right" is thestart
and not theend
.So if you're trying to remove from the beginning of the input, regardless of the language used, using
trimStart
is more appropriate thantrimLeft
.CSS has provided properties that consider the same use case, called "logical properties". So for example,
margin-top
,margin-right
,margin-bottom
,margin-left
, can also be written as (respectively):margin-block-start
,margin-inline-end
,margin-block-end
,margin-inline-start
.Ohhhhh so that's what these margin properties are! Never knew what they mean! Thank you very much! I can add that to my imaginary TIL list :)
There is no difference, as there is no difference between
trimEnd
andtrimRight
.They do the same thing.