I don’t know how to describe how I feel. I can’t say what has happened to me in the past cause I don’t feel comfortable enough to put it online. Though my mind keeps returning to those memories, I wish it would stop. I was thinking of playing FFXIV to escape to another world, but my computer mouse makes that a bit hard to do now. Maybe some YouTube videos for now.
Alexis got accepted for an internship this summer. I think it’s a great opportunity for her. However, I’m going to miss her. We should be able to see her on the weekends.
The cruise we are going on is coming up really soon. I’m excited and nervous too. I’ve never been on a cruise. I’ve never gotten seasick, but I’m nervous I will get seasick. I’m excited about seeing Seattle and Alaska and the food we will eat!
Oh, I finished Stephen King’s Fairy Tale. It was a long book. Not as long as James A. Michener’s Alaska…which is crazy long that will take forever for me to finish. But Fairy Tale is good. I think the book was drawn out a bit, but the story is intriguing. The world of Empis was well-developed and visually stunning, and I felt transported there. Stephen King has said that Fairy Tale was prompted by a question he asked himself early in the pandemic: “What could you write that would make you happy?” And the answer to that question turned out to be a story about a young man who loves an old dog so much that he’s willing to travel through a portal to another dangerous world to save the dog’s life. It had an Alice in Wonderland vibe.
I tried to finish Jim Butcher’s Blood Rites, but I couldn’t remember the first five books in the series. So I started on book one, and now I’m on book three of the series. I have notes from the books, but not on everyone I read.
It looks like I may have to bring Chris to his summer class on Monday and Wednesday. I think I will have a few books lined up to read while he is in class. I wonder how long the class is. Not too long, I hope.
JavaScript is fun but I’ve been a little confused the past few days. So I’m going a little slower in learning this language.
——————————————————
The logical or operator (||) returns true if either of the operands is true. Otherwise, it returns false.
The logical or operator is composed of two pipe symbols: (||). This can typically be found between your Backspace and Enter keys.
The pattern below should look familiar from prior waypoints.
if (num > 10 || num < 5) { return "No"; } return "Yes";
When a condition for an if statement is true, the block of code following it is executed. What about when that condition is false? Normally nothing would happen. With an else statement, an alternate block of code can be executed.
if (num > 10) { return "Bigger than 10"; } else { return "10 or Less"; }
If you have multiple conditions that need to be addressed, you can chain if statements together with else if statements.
if (num > 15) { return "Bigger than 15"; } else if (num < 5) { return "Smaller than 5"; } else { return "Between 5 and 15"; }
Order is important in if, else if statements.
The function is executed from top to bottom so you will want to be careful of what statement comes first.
Take these two functions as an example.
Here's the first:
function foo(x) { if (x < 1) { return "Less than one"; } else if (x < 2) { return "Less than two"; } else { return "Greater than or equal to two"; } }
And the second just switches the order of the statements:
function bar(x) { if (x < 2) { return "Less than two"; } else if (x < 1) { return "Less than one"; } else { return "Greater than or equal to two"; } }
While these two functions look nearly identical if we pass a number to both we get different outputs.
if/else statements can be chained together for complex logic. Here is pseudocode of multiple chained if / else if statements:
if (condition1) { statement1 } else if (condition2) { statement2 } else if (condition3) { statement3 . . . } else { statementN }
If you need to match one value against many options, you can use a switch statement. A switch statement compares the value to the case statements which define various possible values. Any valid JavaScript statements can be executed inside a case block and will run from the first matched case value until a break is encountered.
switch (fruit) { case "apple": console.log("The fruit is an apple"); break; case "orange": console.log("The fruit is an orange"); break; }