Commit No Bug
Published on

Bugs I Encountered While Coding

Authors
  • avatar
    Name
    nikUnique
    Twitter
An image that illustrates bugs in programming

🐛 First Bug

This is the story. I work on my "Sea Battle" game, and there is an array of something that I look at in the console. However, the problem is that I see undefined there, along with other good stuff. I check here and there, but the undefined is still in the array. I have no idea why this is happening. Usually, in similar situations, there is a logical reason behind it. After further investigation, I finally noticed something in the code where I filled the array manually. And it is just a simple comma , that is somehow converted to undefined in my array. Never has a thing like this happened to me before. It was something new. The thing is that I use prettier, and therefore, I thought that a comma would just disappear on save after formatting happens. But it appears that it was considered like an element in the array. The array looked similar to this: [el, el,,]. This is what happened, I think.

🐞 Second Bug

This bug is about styling. In the same project, I need to use the transform: translate property. So I use it like this: transform: translate(50% 50%). I go to the browser, nothing changes, check JavaScript, something else, still doesn't work. In the end, I come back to the style and do not remember how soon I noticed (by the way, did you notice it too?) that I didn't include the comma between values. The correct version is this: transform: translate(50%, 50%).

Here you go, here I described how I encountered and fixed 2 bugs, which both have to do with a comma.

Got questions? Send me an email to commitnobug@outlook.com