It’s been raining all day. The weather is cool outside. When Merlin wakes up I will go make myself some hot tea.
I haven’t written in a short while. I had another doctor appointment last Thursday. My sleep appointment. I was so unprepared that day. I was going to get the title for my Passat but I had put my ID in Tommy’s wallet when all of us went to Kel’s parent’s Anniversary party cause I didn’t feel like bringing a purse. Well, I forgot to take it back out. Then at my doctor appointment I found that I didn’t have my health card. Good thing they said that they have all my information already. Lastly, I have very dry skin and lips so I try to have chapstick and lotion in my bag. I had neither. And it isn’t like I don’t have a buttload of chapstick in my dresser. My sleep doctor referred me to an allergist to help with my allergies and maybe I can sleep better. She also said I need more sleep. My cpap records mostly everything about my sleep so she knew how long I have been sleeping.
Friday Tommy and I went to the botanical gardens and took some pictures. Kel met us at the aquarium right next to the gardens. She was shopping with her mom earlier. It was pretty hot in the gardens. Tommy told me how they have Christmas lights up around Christmas that I’d like to see. The farm that they have in the gardens was sadly closed for remodeling.
Saturday we rested at home. Started up on the stationary bike again. It’s hard to keep motivated to stay on the bike. But I really want to see the results from riding. So I guess that is my motivation.
Sunday we went to St. James Tea Room which I was worried on how many calories I was eating that I went on the bike when we got home. I was reading reddit about the tea room and the menu for the Harry Potter theme hasn’t changed in four years. That has to be kind of boring for the cooks, right? But I like the food. I like the Pumpkin tea. We have some here at home.
———————————
Repeat a given string str (first argument) for num times (second argument). Return an empty string if num is not a positive number. For the purpose of this challenge, do not use the built-in .repeat() method.
function repeatStringNumTimes(str, num) { if (num <= 0) { return ""; } let result = ""; for (let i = 0; i < num; i += 1) { result += str; } return result; } console.log(repeatStringNumTimes("abc", 3));
Truncate a string (first argument) if it is longer than the given maximum string length (second argument). Return the truncated string with a ... ending.
function truncateString(str, num) { if (num >= str.length) { return str; } return str.slice(0, num) + "..."; } console.log(truncateString("A-tisket a-tasket A green and yellow basket", 8));
Create a function that looks through an array arr and returns the first element in it that passes a 'truth test'. This means that given an element x, the 'truth test' is passed if func(x) is true. If no element passes the test, return undefined.
function findElement(arr, func) { let i = 0; for (i = 0; i < arr.length; i += 1) { if (func(arr[i])) { return arr[i]; } } return undefined; } console.log(findElement([1, 2, 3, 4], num => num % 2 === 0));
Check if a value is classified as a boolean primitive. Return true or false.
Boolean primitives are true and false.
function booWho(bool) { if (typeof bool == "boolean") { return true; } return false; } console.log(booWho(null));