Twitter | Pretraživanje | |
Mathias Bynens
Replacing all occurrences of a substring with another string is a common operation. Unfortunately, doing this correctly is surprisingly hard in JavaScript. 🤯 The new String.prototype.replaceAll API is here to help! 🎉
Reply Retweet Označi sa "sviđa mi se" More
Lucas Engel 11. stu
Odgovor korisniku/ci @mathias @wesbos
What exactly is the issue with using the regexp?
Reply Retweet Označi sa "sviđa mi se"
Mathias Bynens 11. stu
Odgovor korisniku/ci @lucasengel @wesbos
It’s explained in the write-up. (Spoiler: you have to remember to escape special RegExp chars + to use the g flag.)
Reply Retweet Označi sa "sviđa mi se"
Amandeep Kochhar 11. stu
Odgovor korisniku/ci @mathias @wesbos
Yay!! All these v8 features are supported using babel or directly using latest chrome version?
Reply Retweet Označi sa "sviđa mi se"
Mathias Bynens 11. stu
Odgovor korisniku/ci @amandeepkochhar @wesbos i 2 ostali
See — for now, you’ll have to use Babel/polyfills. But the functionality is coming to browsers soon! Both and already have flagged implementations.
Reply Retweet Označi sa "sviđa mi se"
Sebastião Tolentino 12. stu
Odgovor korisniku/ci @mathias
But this only work on browser! The replace method with regex works in node too.
Reply Retweet Označi sa "sviđa mi se"
Mathias Bynens 12. stu
Odgovor korisniku/ci @tolentek @v8js
What makes you say that? Once a version of supporting replaceAll rolls into Node.js, it will work there as well, like any other language feature.
Reply Retweet Označi sa "sviđa mi se"
Dayton Lowell 11. stu
Odgovor korisniku/ci @mathias
Oh hey, you created the WebKit bug report. Anyway, it’s not linked in that article. ¯\_(ツ)_/¯
Reply Retweet Označi sa "sviđa mi se"
Mathias Bynens 11. stu
Odgovor korisniku/ci @daytonlowell
Feel free to submit a PR that adds the link! I didn’t because there has been no real activity on the bug yet.
Reply Retweet Označi sa "sviđa mi se"
Noah Rodenbeek 11. stu
Odgovor korisniku/ci @mathias @sarah_edo
"constant"
Reply Retweet Označi sa "sviđa mi se"
Mathias Bynens 12. stu
Odgovor korisniku/ci @DrawnByMouse @sarah_edo
What are you referring to?
Reply Retweet Označi sa "sviđa mi se"