I’m still on hold with the health insurance. It’s been 3 hours. I’m starting to wonder if I will get through today.
I haven’t done my “homework” yet for therapy. Just writing out my trauma seems daunting. It’s a big task. I will get it done. Just not sure when but I’m sure it needs to be done before my next therapy appointment.
My mother sent me and the girls a Christmas card. In her card she said that she just got home and she is recovering, that’s why the card is late. What does that mean? Recovering? Recovering from what? Was she on vacation? Was she in the hospital? Most people don’t say they are recovering from vacation. Though English isn’t her first language so it’s not unusual for her to use words that aren’t normally used in a situation. But does she need to be vague about it?! It’s not like I can ask her questions cause that will just rile her up and she will start screaming at me so it’s best to not bother with asking. Though I do need to send her a card or a letter thanking her for the money she sent. Why did she send me money but never communicates with me is one of those mysteries. The girls got a card each also. I have to mail Lexi her card since she is at school.
Ok, I finally got through to the health insurance and everything is all set for me and the girls on health insurance. I’m happy about that. And I’m happy for not having to be on hold anymore. I also asked about hearing aids and sadly they don’t cover hearing aids. I didn’t think they did. I never heard of health insurance covering hearing aids. The closest I have seen was with Karissa and they only covered one hearing aid. Which was perfect for her cause she only wears one hearing aid since she is deaf in the left ear. But I’ve never had any coverage for hearing aids.
I also made a virtual appt. for Alexis for the doctor so she can get her meds refilled. I wish she had told me that she needed a doctor appointment during her Christmas break. But a virtual appt. is good for her since she has classes and in school. I’m not happy that right now she doesn’t have her meds because she forgot them at home when she left for school again. I worry about her when she doesn’t have what she needs. So far she seems to be doing well.
I also am on a quest to get ahold of LeeAnn, which is proving to be hard. I just messaged her on FaceBook so we’ll see how that goes. Both of her brothers want me to get in touch with her but they have to know just how hard that is to do. She doesn’t really keep in touch with anyone.
JavaScript notes…
———————————————–
Step 85
The value of the currentWeapon variable corresponds to an index in the weapons array. The player starts with a stick, since currentWeapon starts at 0 and weapons[0] is the stick weapon.
In the buyWeapon function, use compound assignment to add 1 to currentWeapon – the user is buying the next weapon in the weapons array.
function buyWeapon() { if (gold >= 30) { gold -= 30; currentWeapon += 1; } }
Step 86
Increasing a value by 1, or incrementing, has a special operator in JavaScript: ++. If you wanted to increase num by 1, you could write num++.
Change your currentWeapon assignment to use the increment operator.
function buyWeapon() { if (gold >= 30) { gold -= 30; currentWeapon++; } }
Step 87
Now update the goldText element to display the new value of gold, and update the text element to display You now have a new weapon..
function buyWeapon() { if (gold >= 30) { gold -= 30; currentWeapon++; goldText.innerText = gold; text.innerText = "You now have a new weapon."; } }
Step 88
You should tell the player what weapon they bought. In between the two lines you just wrote, use let to initialize a new variable called newWeapon. Set this to equal weapons.
function buyWeapon() { if (gold >= 30) { gold -= 30; currentWeapon++; goldText.innerText = gold; let newWeapon = weapons; text.innerText = "You now have a new weapon."; } }
Step 89
Use bracket notation to access an object within the weapons array and assign it to your newWeapon variable. Place the variable currentWeapon within the brackets.
When you use a variable in bracket notation, you are accessing the property or index by the value of that variable.
For example, this code uses the index variable to access a value of array.
let value = array[index];
function buyWeapon() { if (gold >= 30) { gold -= 30; currentWeapon++; goldText.innerText = gold; let newWeapon = weapons[currentWeapon]; text.innerText = "You now have a new weapon."; } }
Step 90
weapons[currentWeapon] is an object. Use dot notation to get the name property of that object.
function buyWeapon() { if (gold >= 30) { gold -= 30; currentWeapon++; goldText.innerText = gold; let newWeapon = weapons[currentWeapon].name; text.innerText = "You now have a new weapon."; } }
Step 91
You can insert variables into a string with the concatenation operator +. Update the You now have a new weapon. string to say You now have a and the name of the new weapon. Remember to end the sentence with a period.
Here is an example that creates the string Hello, our name is freeCodeCamp.:
const ourName = “freeCodeCamp”;
const ourStr = “Hello, our name is ” + ourName + “.”;
function buyWeapon() { if (gold >= 30) { gold -= 30; currentWeapon++; goldText.innerText = gold; let newWeapon = weapons[currentWeapon].name; text.innerText = "You now have a " + newWeapon + "."; } }
Step 92
Back at the beginning of this project, you created the inventory array. Add the newWeapon to the end of the inventory array using the push() method.
Here is an example:
const arr = [“first”];
const next = “second”;
arr.push(next);
arr would now have the value [“first”, “second”].
function buyWeapon() { if (gold >= 30) { gold -= 30; currentWeapon++; goldText.innerText = gold; let newWeapon = weapons[currentWeapon].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); } }
Step 93
Up until now, any time text.innerText was updated, the old text was erased. This time, use the += operator to add text to the end of text.innerText.
Add the string In your inventory you have: – include the spaces at the beginning and the end.
function buyWeapon() { if (gold >= 30) { gold -= 30; currentWeapon++; goldText.innerText = gold; let newWeapon = weapons[currentWeapon].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += ' In your inventory you have: ' } }
Step 94
At the end of the second text.innerText string you just added, use the concatenation operator to add the contents of inventory to the string.
function buyWeapon() { if (gold >= 30) { gold -= 30; currentWeapon++; goldText.innerText = gold; let newWeapon = weapons[currentWeapon].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory + "."; } }
Step 95
Add an else statement to your buyWeapon function. In that statement, set text.innerText to equal You do not have enough gold to buy a weapon..
function buyWeapon() { if (gold >= 30) { gold -= 30; currentWeapon++; goldText.innerText = gold; let newWeapon = weapons[currentWeapon].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; } else { text.innerText = "You do not have enough gold to buy a weapon."; } }