The coding articles collection contains curated stories, tips, questions and answers on a wide variety of topics. The main focus of these articles revolves around the languages and technologies presented in snippets, as well as career advice and lessons.
JavaScript, Function
Closures are used frequently, yet often misunderstood. Understanding them in depth is crucial to be able to write clean, maintainable code.
JavaScript, Function
Aborting a fetch request in JavaScript is a common problem. Here's how to handle it correctly.
JavaScript, Math
When formatting decimal values in JavaScript, trailing zeros can be undesired. Here's how to deal with them.
JavaScript, Array
JavaScript’s spread operator is a very versatile tool. Here are some simple ways to use it.
JavaScript, Object
Freezing objects is not the only way to prevent mutations. Learn how you can leverage the Proxy object to your advantage.
CSS, Visual
Nesting elements with rounded borders can look very wrong if not done correctly. Here's a quick tip on how to do it right.
JavaScript, Testing
Testing your code is important, but mocking can be tricky at times. Here's a quick guide on how to mock global object methods in Jest.
JavaScript, Array
Are you performing a lot of array operations? Maybe element removal is a performance bottleneck you can avoid.
React, Testing
Testing React components that use portals can be difficult until you understand what you really need to be testing.
CSS, Visual
You can use a CSS pseudo-class selector to style all links in a page, without worrying if they have been visited or not.
Python, Function
Mutable default arguments can trip up Python beginners and veterans alike. Here's a quick workaround to deal with them.
Python, Error
It's generally not a good idea to use bare except
clause in Python, but do you know why?
JavaScript, Object
Maps and objects are very similar, but they have some differences that can help you decide which one better fits your use-case.
Both Object.freeze()
and Object.seal()
serve a similar purpose, but there's one key difference you need to remember.
Python, File
When working with files in Python, it's important to ensure that the file is closed correctly. Here are a couple of ways to do that.