if ye want another exciting fact about browser js:
element.append is a thing and accepts multiple dom elements.
(me being one of the people who started with js when netscape had that nice brushed aluminium theme literally missed the addition of this neat little function)
Full-time web dev; JS lover since 2002; CSS fanatic. #CSSIsAwesome
I try to stay up with new web platform features. Web feature you don't understand? Tell me! I'll write an article!
He/him
Full-time web dev; JS lover since 2002; CSS fanatic. #CSSIsAwesome
I try to stay up with new web platform features. Web feature you don't understand? Tell me! I'll write an article!
He/him
Yeah, you definitely could do it that way, utilize myregex.exec() or myregex.match() inside of your method. Could be a nice way to encapsulate some ugly, repetitive logic, especially if you did this sort of thing all the time and wanted to write a factory function to take a regex and generate these search objects. Again, I don't really know if it's any cleaner in the end than just defining a findIndex(str, pattern) function, especially if not everyone reading your code will know about these symbols and understand how you're using them, but when I have the choice, I usually prefer dealing with native methods like str.search(pattern), since they have well-defined behavior and I know what to expect. Personal preference, I guess
Full-time web dev; JS lover since 2002; CSS fanatic. #CSSIsAwesome
I try to stay up with new web platform features. Web feature you don't understand? Tell me! I'll write an article!
He/him
Hey! That's a bit off-topic for this article, so I don't want to go over it in this comments section, but I love talking about that sort of thing, so DM me if you want to talk about it!
Hidden gem 💎 for sure, thanks! 🚀
if ye want another exciting fact about browser js:
element.append is a thing and accepts multiple dom elements.
(me being one of the people who started with js when netscape had that nice brushed aluminium theme literally missed the addition of this neat little function)
Wow, I learnt way more than just the search method. What an article!
TIL me too!
Right??
Great to know ! Thanks for sharing :)
Symbol.search huh - I do like that syntax.
Thanks for sharing Ken. It's very useful. Learnt something new today :-)
So you can make extra wrapper for exec / match method to simplify code in the userland.
Yeah, you definitely could do it that way, utilize
myregex.exec()ormyregex.match()inside of your method. Could be a nice way to encapsulate some ugly, repetitive logic, especially if you did this sort of thing all the time and wanted to write a factory function to take a regex and generate these search objects. Again, I don't really know if it's any cleaner in the end than just defining afindIndex(str, pattern)function, especially if not everyone reading your code will know about these symbols and understand how you're using them, but when I have the choice, I usually prefer dealing with native methods likestr.search(pattern), since they have well-defined behavior and I know what to expect. Personal preference, I guesswow, thank you!
I dont know about "data-*" in html, when do use it?
Hey! That's a bit off-topic for this article, so I don't want to go over it in this comments section, but I love talking about that sort of thing, so DM me if you want to talk about it!
OMG! Data lake in JS. Yeah!