What should I write about today? Everyone is starting to wake up, and I doubt the house will be quiet for long. That’s perfectly fine. This morning, Kel had a flat tire on her truck, so she got a ride to work. Alex filled up the tire, and it seems to be holding up well. Alex and Alexis went to Sonic to grab drinks for everyone.
It seems Kel’s truck tire went flat once more, and Alex and Lex had to take care of it. I feared that might happen. Unfortunately, Alex struggled to remove the tire because he was using the tool incorrectly, so they decided to take it to AutoZone. On a brighter note, I finally got my sugar-free cherry slushie!
I’ve spent the entire day coding and have some of my work displayed below. I plan to clean my monitor and keyboard, so I’m going to turn off my computer. I find it much easier to clean the keyboard without the worry of accidentally pressing any keys.
My cleaned up version of the pyramid code:
const character = "#"; const count = 8; const rows = []; let inverted = true; function padRow(rowNumber, rowCount) { return " ".repeat(rowCount - rowNumber) + character.repeat(2 * rowNumber - 1) + " ".repeat(rowCount - rowNumber); } for (let i = 1; i <= count; i++) { if (inverted) { rows.unshift(padRow(i, count)); } else { rows.push(padRow(i, count)); } } let result = "" for (const row of rows) { result = result + row + "\n"; } console.log(result);
Since the code asks if the pyramid is inverted(true), my pyramid is inverted. If you have the inverted as false, it would look right side up.
Next project is a gradebook app. That should be pretty straightforward. I hope. Lol!
My getAverage and getGrade functions:
function getAverage(scores) { let sum = 0; for (const score of scores) { sum += score; } return sum / scores.length; }
function getGrade(score) { if (score === 100) { return "A++"; } else if (score > 89) { return "A"; } else if (score > 79) { return "B"; } else if (score > 69) { return "C"; } else if (score > 59) { return "D"; } else { return "F"; } }





