I'm passionate about web development and design. A team player who treasures effective communication. Eager to learn as much as is humanly possible on my road to web-development knighthood(haha).
Location
Nigeria
Education
Bachelor of Engineering, specializing in Electrical and Electronics discipline
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!
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).
So you thought of using a RegEx, ended up discovering Split, then had to use a RegEx in your Replace anyway?
At that point you might as well go all-in:
(Typed on a phone, may not be perfect)
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!
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)
.Yea I was thinking the exact same thing. Probably didn't notice the /"/g was regex