Hell Was The Journey But It Brought Me Heaven

Hell Was The Journey But It Brought Me Heaven

The above is a quote from one of my favourite Taylor Swift songs, Invisible String. 

I first discovered it by listening to the piano cover. It was during the lockdown and while I was finishing my second MSc thesis. That whole Folklore album really just changed my life though. 

Have you ever been into the woods? But like really into the deep dark woods? Have you ever really forged a connection, with a place, with a tree, with the forest? That album is really what the deep dark woods sound like. And I love it.

I'm here for it.

P.S. I started listening to Bach today instead of my usual Lana del Rey songs. I liked it but then I started missing Lana del Rey.

Default Parameters

Okay so one quick thought I have here is that the course keeps telling me "when an argument is passed". 

What does it mean for an argument to be passed? 

Does it just mean when the parameters are put into the brackets once we actually call the function?

And I guess that the default parameters are only put in when we actually declare the function?

"By using a default parameter, we account for situations when an argument isn't passed into a function that is expecting an argument" - Codecademy

This wasn't actually too hard in the end - it just means that you put in a default parameter in case the value is 'undefined' (?!) or in case you don't put a value in (or in case you have a value you use regularly and you want to use this by default (?!). I suppose?

So

instead of 

function wishGreatDay (wish) {
    console.log(`Have a ${wish} day!`)
}

You could have:

function wishGreatDay (wish = 'fab') {
    console.log(`Hava a ${wish} day!)
}

So then if you called the function:

wishGreatDay();

Then the output would be:

Have a fab day!

And that is the default output.

And this would only change if I called the function with new parameters. 

For example:

wishGreatDay(awesome);

would log:

Have a awesome day!

(This is grammatically incorrect, and it is really upsetting me).

One more example would be:

wishGreatDay (lovely);

Would log: 

Have a lovely day!

I am not 100% sure if  all of these examples are technically correct. I understand that they are, but feel free to point anything out/correct them to me if they aren't!

Return

The 'return' keyword

Or also known as a return statement, I guess.

"To create a return statement, we use the return keyword followed by the value we wish to return." - Codecademy

Great. Yep, nope, I don't understand anything. NOOOOOOOOOOOOOOOO.

"The return keyword is powerful because it allows functions to produce an output. We can then save the output to a variable for later use." - Also Codecademy

But how? The example also used the return keyword within a function as a sort of an else-if statement but it didn't make it all that clear how it worked. Arrrrrrrgh. Whyyy.

This thing is asking me to write return inside of my function bodies which I never did before. Wait so does that mean that all of my previous functions were a LIE?

I did the exercise... I got everything right. I guess that... return RETURNS the function... but you still need console.log() to log it to the console. So... I guess that you need a bit of BOTH right?

That is where I was getting a bit lost before but return RETURNS the function and console.log() LOGS it. WHY ON EARTH DO YOU NEED BOTH?

I AM STRUGGLING WITH THE IMPORTANCE OF THE RETURN FUNCTION.

What I HAVE learned 

I learned that you need to write the word function first to declare a function. You laugh - but I was practising declaring a function. And I almost forgot to write the word function first.

Went Back To A Bit Of CSS Today

I read a bit about the Box Model. I know, still. I have been reading about Visibility. 

Visibility

You can use the visibility property to display, hide and collapse elements. However if you hide them then the empty space would still remain on the page. 

If you want to hide something completely, you can use the display: none function.

So an example of visibility would be, if I made up a class of .
conclusion

.conclusion {
    visibility: hidden;
}

Or it could be:

.conclusion {
    visibility: visible;
}
Reviewing the Box Model


I am so confused. I just read that height and width can be set in percentages as well as pixels but I have only been doing it in pixels. Percentages... of what, exactly?

Other points in review:
  • Padding sets the space between the content area and the border; it is like the space between a picture and its frame.
  • Margin is the amount of spacing outside an element's border.
    • Horizontal margins ADD
    • Vertical margins COLLAPSE
      • 'The space between vertically adjacent elements is equal to the larger margin.'
  • Codecademy also says that "margin: 0 auto horizontally centers an element inside of its parent content area, if it has a width."
  • The overflow property can be set to displayhide, or scroll

A picture of the coastline that I live near. I don't live exactly by the beach and I don't even know where this place is but it's a pretty good indication of the vibe that you can get around here, if you get walking...




Comments

  1. "Does it just mean when the parameters are put into the brackets once we actually call the function?"

    Yes 😎

    ReplyDelete
  2. Oh. Well that easy. Now I feel pretty embarrassed lol πŸ˜‚ Haha, oh well, thank you so much πŸ˜‚

    ReplyDelete

Post a Comment

Popular posts from this blog

Hello World

“But yesterday, I heard God say, you were born to be the one…”

In the Water, I find Fire