Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
I used a function as the second argument, but I didn't we could do this.
Super clean code
Oh yeah, forgot. Thanks!
This solution only works for 8-bit ascii characters. I learned something new from this, though!
Strings are immutable. Any altering method or operation on a String will return a copy or an immutable singleton.
Nice and simple, but I think it's best to declare a new variable to store the new string rather than mutating the original.
Nice. A bit cleaner than mine, I'll admit.
From your link:
"$1, …, $9 can also be used in the replacement string of String.prototype.replace(), but that's unrelated to the RegExp.$n legacy properties."
hm :) what is such Ä ß ... characters about?
$& whould be better which represents it self
I didn't known you could use $1 with replace
:kek:
Awesome
It's ok to use it in a replacement string. Would be superweird if that would deprecate; Regular expressions are more widely used like that in many languages.
What seems to be deprecated is accessing these values as a property of Regexp. So using e.g.
RegExp.$1
is deprecated.https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Deprecated_and_obsolete_features#regexp
This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/n
wow!
Loading more items...