New answers tagged

2

I'd suggest making this a function - while as a oneliner, it's good as is, when we start scaling it, adding in more cases, etc., it becomes a mess that requires rearranging for even the tiniest changes. But first, let's start off with the changes I'd suggest. First off, I'd like to slightly adjust your regex to handle URL parameters: \/\d{3,9}(\/?\?([\-\w%...


2

Yes, it's correct to use const here. That would be considered idiomatic Javascript. If you're using const when you shouldn't, you'll notice as it will produce a TypeError. People coming from other languages might disagree as they think that const means that the variable is constant/immutable (which is not the case, it's just not re-assignable). But that is ...


Top 50 recent answers are included