In today’s post, I want to talk about a common issue I see in beginners’ code. It’s not wrong, per se, but it can be made more efficient. Here’s a way you can make your code cleaner when returning boolean values.
I write about front-end web development. I'm inspired by Nathan Barry's motto,
teach everything you know. I also take a lot of inspiration from my friend and mentor, Chris Ferdinandi.
Search my blog
In jQuery, we can remove all child nodes from an element using the
empty() method. Let’s create a helper function for this using only vanilla JS.
You can use the native
querySelectorAll() methods to get an element or set of elements from the DOM. But did you know you can scope these methods so they only search within a particular element?