Instead of using jQuery’s .toggleClass() method to add or remove classes from an element, I can use the Element.classList.toggle() method to achieve the similar goal. The method will return true if the value is successfully added to the element class, otherwise, it will return false.
It’s a perfectly valid choice for a fairly simple application.
Filter my list of cars
Filter my list of heroes
Filter my dirty clothes…
Filter my favorite shoes…
Filter my favorite foods…
Filter the candidate to be included in my crew…
I think there is a lot of things we can filter out of an Array. A lot of things…
Have not used Array.filter() before? If yes, then consult the complete reference at MDN.
I am pretty much beginner when it comes to CSS page layout techniques. Even though I’m comfortable using Bootstrap to do layout elements, but still, there is something missing. Something which I don’t quite understand when it comes to layout elements without relying on a CSS framework. So, I decided to make my self aware of different techniques for CSS page layout.
After I finished reading the Introduction to CSS layout article, I can categorize two ways to do layout:
- the old-fashioned way
- the modern way
The old-fashioned way is when using Float and Positioning techniques, while the modern way is using CSS tables (display: table), Flexbox and Grid.
I’m glad to aware there are many options to layout elements, and I am more inclined to deep dive for each of the techniques mentioned before.
Working as a front-end developer I frequently using DevTools Console to do almost anything inside the console (e.g. interacting with the HTML document using DOM API).
I usually open up DevTools Console with the following steps:
- Pressing this combination of keyboard shortcuts: Ctrl + Shift + I.
- Click the Console panel.
Slightly longer path to open up DevTools Console
but, there is a shorter path, just press Ctrl + Shift + J.
Thanks for the universe for pushing me to get better at something, and this article Tools for Web Developers: Using the Console.
It’s cool, isn’t it? Imagine if we can tap this tool into build process to keep the codebase as clean as possible. But, if you guys also curious enough about jsinspect like myself, try to use it in your daily workflow, see how the tool can help you find the duplicate code easily.
I skimmed the window object references and interested to know more details about the window.onload event. Something that I frequently used in many other ways, but I notice something that I didn’t know. The things that I didn’t know about this event is when is the window.onload will be called, it’s:
- called after all resources loaded (e.g. css, js, images, scripts, etc.)
- called after the DOM are fully loaded