DEV Community

Discussion on: Trim Your Inputs!

Collapse
 
myzel394 profile image
Myzel394

What's the difference between trimStart and trimLeft?

Collapse
 
juneate profile image
RP

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.

Collapse
 
myzel394 profile image
Myzel394

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 :)

Collapse
 
eligarlo profile image
Eliahu Garcia Lozano

There is no difference, as there is no difference between trimEnd and trimRight.

They do the same thing.