Love Coding
A blog focused on programming, debugging, and refactoring real-world code
function deploySafely()
if (isFriday()) {
console.warn(“Do not touch production.”);
return;
}
deploy();
}
Code is like a joke. If you have to explain it, it’s bad.
Practical code
Quick coding tips
Optional Chaining: The Safe Way to Access Data
You can avoid “Cannot read property of undefined” errors by using optional chaining, which safely checks whether a value exists before accessing its properties.
const city = user?.profile?.address?.city ?? "Unknown";
Optional chaining lets you navigate deeply nested objects without writing multiple defensive checks – clean, safe, and modern.
Write Cleaner Code with Guard Clauses
Instead of writing nested if statements, you can use guard clauses – early-return checks that immediately stop the function when the input is invalid. This makes your code cleaner, easier to read, and much easier to maintain.
function processString(value) {
if (typeof value !== 'string') return null;
if (value.length <= 3) return null;
return value.toUpperCase();
}
Keep Only What You Need with .filter()
You can use .filter() to instantly remove unwanted items from an array while keeping the original array unchanged.
const positives = numbers.filter(n => n > 0);
.filter() returns a new array – perfect for cleanup, searches, and simple validations.
Categories
CSS
Styling tips and techniques to create beautiful, responsive web designs
7 postsFront-end Developer Tools
Essential tools and workflows to boost your front-end productivity.
2 postsHTML
Best practices for writing clean, accessible, and semantic markup
12 postsJavaScript
Modern guides and tips for dynamic, interactive web development
3 postsLinux
Developer-focused tutorials for mastering Linux and the command line
1 postPHP
Practical tips for building powerful and secure web applications
4 postsProgrammers mindset
Improve your problem-solving, focus, and growth as a developer
0 postsPrzykładowe projekty juniora
7 postsReact
Learn to build fast, reusable UI components with React
12 postsReact Native
Guides to creating cross-platform mobile apps with React Native
4 postsWordPress Development
Advanced tips for customizing and optimizing WordPress sites
Blog
Latest posts
Code review: Common mistakes found in developers code
Code review is not only a learning opportunity for the person whose code is being reviewed. It is also a…
Security by Obscurity – Why Hiding Is Not Security
In the world of IT, it’s easy to come across practices that look clever at first glance but are little…
Cognitive Biases in the World of IT
In the technology industry, dozens of decisions are made every day, from architectural choices and implementation details to estimates and…
5 years with code: the most important lessons that change how you think about being a web developer
The first years of commercial work in IT are an intense period of learning, not just technology, but most importantly…
What are data- attributes in HTML and what are they used for?
Data- attributes in HTML – what are they and what are they used for? When writing a website in HTML,…
Object destructuring in JavaScript
Object destructuring is a syntax in JavaScript that allows you to extract values from objects and assign them to variables…
Category
JavaScript
jQuery infinite scroll image gallery
Infinite scroll gallery is a simple and difficult task at the same time. It all depends on how you want…
What is hoisting in javascript?
Every junior front-end developer should know what hoisting is. This issue can be easily understood, so if you have not…
How to check if string contains substring in javascript
Depending on what you currently want to achieve, you can use several solutions to check if the string contains substring:
Category
Front-end Developer Tools
Category
Linux
Category
CSS
How to set div to 100% window height?
Tworząc strony internetowe zdarza się, że chcemy, aby div z określonymi informacjami zajmował całą wysokość okna, niezależnie od wysokości tego…
How to center div horizontally and vertically in css
The problem of centering divs or text is quite common and I often had to spend more time fixing it…