Uncategorized

A blustery day

Ok, I think I finally figured out the Fibonacci sequence function. It took me days and I this function seems to work when I console.log it. Here is the function:

function fibonacci(n) 
{ if (n <= 0) return [];   // Handle invalid input 
if (n === 1) return [0]; 
if (n === 2) return [0, 1];     

let fibArray = [0, 1];   // Start with the first two numbers 
for (let i = 2; i < n; i++) { 
fibArray.push(fibArray[i - 1] + fibArray[i - 2]);  // Add the sum of the last two numbers 
}     
return fibArray; }

//Console.log on JavaScript Playground
console.log(fibonacci(10));  // [0, 1, 1, 2, 3, 5, 8, 13, 21, 34]

This has been particularly challenging for me. I even Googled explanations for coding as if I were a five-year-old. At times, I struggle to believe that I'm capable of coding. While I enjoy it, there are moments when I feel I’m not cut out for this. Certain pieces of code make sense, and I can explain them if asked, but it often takes me a long time to reach this understanding. I can’t help but wonder if others in coding experience similar delays in grasping concepts. Although I know I shouldn't doubt myself so much, it’s difficult not to.

I understand that coding isn’t about achieving instant mastery; it's about persistence, problem-solving, and continuous learning. The key is to keep pushing through, as it will become easier over time. Yet, I wish it felt a bit more natural for me.

The wind outside is quite fierce! Even with my noise-canceling headphones on, I can still hear it howling. Typically, I don't notice the wind from inside very well, but today is different. According to the weather app, the wind speeds are between 35 to 45 mph with gusts reaching up to 60 mph. That’s certainly strong, and it explains why my allergies have been acting up. We have Merlin indoors for most of the day.

On Saturday, I visited the library to update my account and placed a book on hold. I plan to explore some other books later today. That morning, Tommy and I woke up at 3 a.m. to drive a few hours to the wildlife refuge and capture the sunrise on camera. I posted a sunrise photo on Facebook and Instagram that day—it was a lot of fun. We enjoyed breakfast and lunch outside using the Blackstone griddle. As Karissa aptly put it, it felt like a "mini camping trip." We returned home around 4:30 p.m. Kel was busy with a work fundraiser, so it was just me, Karissa, and Tommy at home, and we decided to go to Dairy Queen for dinner. A Blizzard was a nice treat!

On Sunday, we took it easy at home. I spent a good part of the day watching YouTube and playing Final Fantasy. Later that night, we attended Tommy's hockey game. Unfortunately, his arm is hurting today because a puck hit his elbow.

For lunch today, I had a sandwich. It was one of those days when nothing else came to mind, so a sandwich was my go-to option. Tonight's dinner will be tacos. Earlier, I prepared some beans. Now, I'm off to make myself a cup of hot tea and review the next function I need to write. My task is to create a function that takes two arrays and returns a new array containing only the elements they have in common. This one doesn't seem too complicated.

Facebooktwitterredditpinterestlinkedinmail