It’s almost Friday! I’ve spent the morning coding, and now it’s time for lunch. I’ve made significant progress and feel confident that I can complete my code today. The animals seem quite calm; they’re all napping at the moment, even Merlin who has settled comfortably in the girls’ room. As for lunch, I’m still undecided about what to eat. I have some leftover chicken that I’m considering, perhaps turning it into a sandwich.
Interestingly, it’s warmer outside than the weather forecast predicted. I’m optimistic that we’ll have a chance to work in the garage this weekend. I don’t have much more to share for now; I’ve finished my sandwich and am about to dive back into coding.
I believe this code works. It makes sense:
function reverseLinkedList(head) { let prev = null; let current = head; while (current !== null) { let next = current.next; // Save the next node current.next = prev; // Reverse the link prev = current; // Move prev forward current = next; // Move current forward } return prev; // New head of the reversed list }
I will explain it here:
let prev = null;
We start with prev as null.
This will eventually become the new head of the reversed list.
let current = head;
We initialize current to the start of the list.
We’ll use current to walk through the list.
while (current !== null) {
Keep looping while current is not null (in other words, while there are still nodes left to visit).
let next = current.next; // Save the next node
Before we change anything, we save the next node.
Why? Because in the next step, we’re going to break the original link.
current.next = prev; // Reverse the link
Now we reverse the pointer:
Instead of pointing to the next node in the list, we make it point to the previous node (prev).
So if it used to be:
1 -> 2
Now it becomes:
1 <- 2
prev = current; // Move prev forward
Move prev one step forward.
We're getting ready for the next reversal.
current = next; // Move current forward
Move current to the next node we saved earlier.
This keeps the loop going until we’ve visited every node.
return prev; // New head of the reversed list }
At the end, prev will be pointing to the last node, which is now the new head of the reversed list.
Example of loop:
1 -> 2 -> 3 -> null
Step-by-step reversal:
- After 1st loop: 1 -> null, prev = 1, current = 2
- After 2nd loop: 2 -> 1 -> null, prev = 2, current = 3
- After 3rd loop: 3 -> 2 -> 1 -> null, prev = 3, current = null
- Loop ends. Return prev, which is 3, the new head.
Since we may or may not see the Louvre in France, I thought I'd look it up. I found some interesting facts:
1. It Wasn't Always a Museum
The Louvre started as a fortress in the late 12th century to protect Paris from invasions. You can still see remnants of the medieval fortress in the basement!
2. It’s the World’s Largest Art Museum
The Louvre is massive — it covers over 782,000 square feet. If you spent just 30 seconds looking at each artwork, it would take you about 100 days (non-stop) to see everything.
3. Not Just French Art
The Louvre’s collection spans 8 departments including Egyptian antiquities, Islamic art, and Greek sculptures. It’s a global treasure trove!
4. Napoleon Took the Mona Lisa for Himself
When Napoleon Bonaparte ruled France, he hung the Mona Lisa in his personal bedroom in the Tuileries Palace. That’s some serious flex.
5. The Pyramid Was Controversial at First
The iconic glass pyramid entrance, designed by I.M. Pei, caused a public outcry in the '80s. Many Parisians thought it clashed with the classic architecture — now it’s one of Paris’s most beloved landmarks.
6. There’s a Mini Louvre Underground
Beneath the Louvre is the Carrousel du Louvre, an underground shopping mall — and yep, there's even a second, upside-down glass pyramid.
7. It's Been in the Movies
From The Da Vinci Code to Lupin (Netflix series), the Louvre is basically a film star in its own right.
8. Not Everything Is on Display
The museum owns over 615,000 artworks, but only about 35,000 are on display. The rest are either in storage or undergoing conservation.





