Carl Anderson

How to Add Event Listeners to Dynamic Content with Event Delegation

Have you ever added a button to a page with JavaScript expecting it to function fully, but when you clicked it nothing happened? You've double checked your code - you're creating the event listeners, the selectors are correct, but it's still not working! Chances are, if you've hit this situation,

JavaScript Closures, and How They Work

Closures, as well as being a favourite interview question, are one of the more confusing parts of JavaScript. Despite the wealth of articles offering explanations of closures, there are dozens of threads on reddit and other forums asking for more help with closures. It's not hard to see why, since

How to write comments to improve code clarity

I'm not going to lie - I used to struggle writing comments. I have wasted hours writing comments that aren't helpful to anyone, while leaving out comments that have cost me hours of debugging time. As we learn to code, we get taught to write comments early. In FreeCodeCamp's curriculum,

Function Declarations vs Expressions: A Quick Guide

Here's the question: What's the difference between these two methods of creating a function? function a() { //This is known as a function declaration console.log("Hello"); } var b = function() { //This is known as a function expression console.log("World"); } Both of these methods do almost the same thing, however there

Bad code isn't shameful

Let's be honest. We all write bad code. Sometimes, we write absolutely shocking code. In the programming community, we have an obsession with "good" code – and it's not difficult to see why. Good code is objectively better than bad code. It's faster, cleaner, more maintainable – Why would you settle for

Carl Anderson © 2026