DEV Community

Discussion on: Two string methods every JavaScript developer should know.

itz_giddy profile image
Audiophile Author

Hi Adam, so I guess the point for me was applying something that I understood. My knowledge of RegEx isn't the best, and I wanted to apply something in the code base I could explain if asked. Thanks for sharing!

jalovatt profile image
Adam Lovatt • Edited on

That's fair, though I would argue the level of RegExiness involved here is something everyone should make a point of learning because it solves so many problems.

An even shorter alternative, since you know the input format won't change: const justDate = date.slice(1, 11).