I’ve figured out how to write that takes two arrays and returns a new array containing only the elements that are common between them: function findCommonElements(arr1, arr2) { return arr1.filter(element => arr2.includes(element)); } The console.log works: console.log(arrayIntersection([1, 2, 3, 4], [3, 4, 5, 6])); // [3, 4] The next problem is to write a function…
Author: desertkitten_md0op6
An anxious day
I feel alright, though I’m experiencing a bit of anxiety. Today, there’s something about coding that appeals to me, even if I’m struggling with it; it feels like a safe pursuit, like I’m engaging in exactly what I’m meant to be doing. I’ve locked up the house, as my anxiety is a bit heightened. I…
An easy day
I had my doctor’s appointment this morning, and it went well. My blood pressure was a bit low, so she advised me to reduce my blood pressure medication by half. We will monitor how this adjustment affects me over the next month. I check my blood pressure in the morning, and it tends to be…
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
It’s Friday!
I’ve decided that I want to dye my hair, and I’m planning to do it in the summer before the cruise. I’m thinking about going for a dark, blackish-red color. It’s a bit difficult to describe, but I definitely want it to be dark. I’m not sure if I’ll get a haircut before coloring my…
Hello, Thursday
The Fibonacci function has me perplexed. There are so many examples available online that I’m unsure whether I should simply follow those or attempt to code it from scratch and see if that yields results. I realize my thoughts may seem a bit unclear at the moment; that’s just how my mind is working today….
Hello, Thursday
The Fibonacci function has me perplexed. There are so many examples available online that I’m unsure whether I should simply follow those or attempt to code it from scratch and see if that yields results. I realize my thoughts may seem a bit unclear at the moment; that’s just how my mind is working today….
Hoping for rain
I have spent my morning figuring out how to write a function that returns an array containing the first ‘n’ Fibonacci numbers. I found out what I need to do: Initialize an empty array. If n is 1, return [0] (since the first Fibonacci number is 0). If n is 2, return [0, 1]. Otherwise,…
Another coding day
I’ve just had my second cup of coffee. I’m trying to figure out how to write a function that checks if a word is a palindrome. This is what I have so far: function isPalindrome(str) { // Convert string to lowercase and remove non-alphanumeric characters let cleanStr = str.toLowerCase().replace(/[^a-z0-9]/g, “”); } In the context of…
Not-so-manic Monday
You might expect that I’d have more to write about on a Monday since I take breaks from writing over the weekend, but surprisingly, I don’t have much. Karissa’s glasses just broke; the arm snapped right off. They’re only two years old. I suggested she schedule an eye appointment to see if she needs a…