The No-Cheat Code Challenge - Surviving The Odin Project
Tags: beginners, webdev, javascript, learning
Published: 2024-06-01 20:23:57

Hi, it’s Blazej, At the beginning of my coding learning journey, I promised myself I would not cheat.

## What Do I Mean by Cheating?
When solving any exercise, I promised myself I wouldn’t look up the solution until my own code was working.

## Choosing The Odin Project
I decided to go with The Odin Project because I was tired of Udemy courses and YouTube videos, which were not bad by any means, but I felt like they weren’t getting me anywhere.

I found it hard to focus after just three minutes of watching each video, and my thoughts would start to drift away. But this is the subject for another blog post.

## Diving into The Odin Project
The Odin Project curriculum is based on reading documentation and solving exercises, making projects, reading more documentation, solving even more exercises, and building even more projects that, as you guessed, become more difficult as you progress.

Everything was fine until I reached this point:


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s2iqhpse9m5ly1u8eusb.png)


## The Challenge of Palindromes and Fibonacci
I remember it was a long weekend, and I spent all 4 days trying to solve everything. The first few exercises went smoothly, but I got stuck on Palindromes (which I eventually solved) and Fibonacci.

Oh yes… That was a killer. But you might ask, there are no such exercises listed in the above picture, right? Yes, but as you go to the mentioned repository, you will find them in the 8th and 9th positions.

It took me so long to solve the previous exercises that I lost track of where I was supposed to stop and just kept going.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sixuuw00qr80zdme8map.png)


## The Struggle with Fibonacci
I was thinking hard, having tea after tea. As time passed by, my thoughts started drastically changing from “it’s all simple, I will do it” to “something is probably wrong, my thought process seems to be right, there must be some mistake in the exercise itself. Maybe I should look up the solution?”


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a89hvw0sl9h7k2uwgoql.png)


When I study, I use the [Pomodoro technique](https://www.toptal.com/project-managers/tomato-timer): 25 minutes of focus followed by a 5-minute break.

Pomodoros were passing by, and I managed to get to the point where I was able to get some sort of Fibonacci sequence… but it still seemed not right.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gte7bzvgqee5qiuj2w8h.png)


## The Moment of Temptation
At this moment, I thought, “Ok, I got to this point, there is probably something I will learn later on, so I can have a look at the solution and just move on.”

I did as I thought… Of course, I was like, “Oh yeah, it’s that easy and logically thought out. Ok, let’s move on then!”

## Realizing the Mistake
After Fibonacci, there was an object exercise to be solved, and I was confused because we hadn’t gotten to objects at that point in TOP yet.

And I was right, I went a few lessons ahead by mistake…

It only assured me that cheating was the right thing, and I would soon learn something new that would make me solve it later or with more ease. Haha!

## Returning to Palindromes and Fibonacci
A couple of lessons passed, which took me around a week to go through, and I was back at Palindromes and Fibonacci. This time, a little bit stressed though…

Palindromes went smoothly, and I sat down to do Fibonacci. I have to mention here that when I opened the file with the exercise, it was of course solved, so I tried not to look at the code much.

I just marked everything and deleted it. However, I remembered that the first line was:

`let fib = [];`

## The Final Struggle
I began solving it. Nothing was working. I decided to make dinner and go for a walk. Every single time I was away from the computer, my brain was racing back to Fibonacci.

I felt like I had VSCode running in my head. I swear, instead of seeing chips cooking in my air fryer, I could only see lines of Fibonacci code (especially that bloody loop and ‘if’ statement).

The funny feeling was, of course, imagining some solution just to realize 5 seconds later that either I had already tried this or simply realized that JavaScript doesn’t work like that at all!!!

## Breakthrough Moments
I ate and went for a walk. 1 hour of walking = 1 hour of deep thinking. I had 3 new solutions written in my notes, and was 100% sure they would work.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o5boq8777ppnk48mjm8d.png)


Guess which of those worked out. Yes, you are right, NONE! I was still getting the same results. At that moment, I thought about adding something to the array.

I knew I needed something there. But deep in my brain, I was getting the response, “When you deleted the solved exercise before, that array was empty though.” I just lied to myself.

## Sticking to My Principles
I went back to reading documentation and some articles, but I knew I couldn’t cheat this time. I had already learned that cheating doesn’t help in the long run, and I would just face the same issue later if I cheated now.

Three hours passed. I wasn’t frustrated anymore. I wanted this to be solved, and I wanted to understand what I was doing wrong. I also felt as if I knew how this loop was working, and it seemed to me that I had already tried every single configuration with conditional statements.

## Asking for Help
The only solution I had in my head was to reach out for help on the Discord channel.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5nkp2mcrkwidcf4m0d1k.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/adeaweslt341nw9rjcc0.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7mnrvl832iy1qrw61iq3.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/camtjqo79fsnuax53jzk.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0w0j8hrpbbwxvzvkmbpy.png)


## The Solution and Lessons Learned
I solved it!!!! Look, I had to put values into that array and pull the conditional before the loop. That’s what my brain was actually telling me 10 or more hours before.

But because I had seen a little bit of the solution, I kept lying to myself not to do it, believing it was different. Ehh.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p460dact5ig25g61vh6n.png)


## Conclusion
The second lesson I learned on this day was to, of course, ask for help. But I strongly encourage everyone to go through the process of reading documentation and trying to solve everything on their own, especially when you are still learning.

I learned a ton during this process and believe that I will not make this mistake again.

Now I am much more ready to hit another wall with some other exercise. I am familiar with the process now!