Days 46, 47 & 48: April 17, 18 & 19, 2019

Today’s Progress: Introduction to JavaScript Pt. 6 (FCC)

Thoughts: Another three day update, Mimi?

Alright, hear me out here. Everything was going great Wednesday, I was flying through the lessons but then I hit this one:

I was so painfully confused. I literally had no clue where to even start. I ended up having to watch a youtube video tutorial and check out the hints. Eventually my last resort was peaking at the answer.

Turned out to be much more confusing than I could have ever imagined. But after breaking it down, I think I caught on to what was happening?

Like the first two if statement:

if(prop === "tracks" && value !== ""){
if(collection[id][prop]) {

Basically what this is saying is, if the inputed property variable is “tracks” and the value given isn’t an empty string, and the ID array does have a property of “tracks” in the first place, push the value into the tracks property.

Next is the first else statement:

else {

This one is actually still under the first if statement, so for it to occur, the prop inputed still has to be “tracks” and the value can’t be an empty string. But this part will only occur if the second if statement isn’t a thing, so if there’s no “tracks” property under the ID array given, the function creates one and puts the value in it.

The next part goes like:

} else if (value !== ""){
collection[id][prop]= value;

This is still counting on the value not being empty, but this time around, the prop inputed isn’t tracks. This part of the function will put the given value into whatever the property is.

Final section states:

} else {
delete collection[id][prop]
return collection;

Basically if the given prop is imputed with a value that is an empty string, delete the property.

Then with each pass through the function, return the entire collection array.

So in the end, I’m able to read it and understand it..but coming up with things on my own from memory isn’t as easy.

Definitely something to work on.

There’s only a few lessons left in the basic JavaScript section of FCC, but I’m def going to find a way to practice everything before moving on. I’m nowhere near ready.

Link To Project: N/A

Leave a Reply

Your email address will not be published. Required fields are marked *