3 ms·
I'm sorry, but I don't get this part: something.replace /^\/?/,'/' I'm a little sleepy, so maybe I'm missing something, but doesn't it replace a possible
by pooriaazimi 14y ago
I'm sorry, but I don't get this part:
something.replace /^\/?/,'/'
I'm a little sleepy, so maybe I'm missing something, but doesn't it replace a possible '/' at the beginning of some lines with '/'? Isn't that just a waste of CPU cycles? It effectively does nothing.
- pygy_ 14y agoThe key is the question mark. The regexp also adds a slash if none is present initially.