We have a puppy! His name is Merlin and he is a mix Malinois and Australian Shepherd. He’s very cute! Both Mimi and Merlin are sleeping under my chair at the moment. Karissa had Merlin most of today since I was busy cleaning and doing errands. Having a puppy is almost like having a newborn. He puts everything in his mouth! And still cries through the night. Merlin likes Mimi. Mimi is getting used to him. She still doesn’t want to play as much as Merlin wants to play.
Tom and Kel got new dressers in the bedroom. I finished putting some of Tom’s clothes away. I like the dressers. They look nice. I’m a half inch taller than Tom’s dresser. I can’t even see the top of it.
We have booked another cruise for next year. A different cruise ship, ten days to Alaska. I’m excited. I want to go see the places we have seen the last time and this time when I go to Seattle.. to get a postcard from Seattle. We are seeing a few new places also when we go this time. The trip is going to be me, Tom and Kelly this time.
I still don’t have health insurance and I’ve been checking on the status everyday. I did get a letter in the mail saying there is a delay. I’m calling them tomorrow. The withdrawal symptoms from my medications are gone so that is good. But without my medication my moods are all over the place. I feel irritable too easily.
I’ve done some coding today. I have been having this page up without posting for the past few days so I can put some notes up here. I understand the small snippets they give us. But I still don’t know how to put all this together in a code and have it work.
I feel like I didn’t write much today. My moods just have been down today. I hope to get this health insurance thing taken care of soon.
JavaScript notes…
—————————————
ES6 makes destructuring arrays as easy as destructuring objects.
One key difference between the spread operator and array destructuring is that the spread operator unpacks all contents of an array into a comma-separated list. Consequently, you cannot pick or choose which elements you want to assign to variables.
Destructuring an array lets us do exactly that:
const [a, b] = [1, 2, 3, 4, 5, 6]; console.log(a, b);
The console will display the values of a and b as 1, 2.
The variable a is assigned the first value of the array, and b is assigned the second value of the array. We can also access the value at any index in an array with destructuring by using commas to reach the desired index:
const [a, b,,, c] = [1, 2, 3, 4, 5, 6]; console.log(a, b, c);
The console will display the values of a, b, and c as 1, 2, 5.
Use destructuring assignment to swap the values of a and b so that a receives the value stored in b, and b receives the value stored in a.
In some situations involving array destructuring, we might want to collect the rest of the elements into a separate array.
The result is similar to Array.prototype.slice(), as shown below:
const [a, b, ...arr] = [1, 2, 3, 4, 5, 7]; console.log(a, b); console.log(arr);
The console would display the values 1, 2 and [3, 4, 5, 7].
Variables a and b take the first and second values from the array. After that, because of the rest syntax presence, arr gets the rest of the values in the form of an array. The rest element only works correctly as the last variable in the list. As in, you cannot use the rest syntax to catch a subarray that leaves out the last element of the original array.