Crimson and Clover, Honey
Crimson and Clover Honey, Over and Over Honey
"Me myself I like diamonds, but baby crimson and clover".
I couldn't take it anymore. I WENT BACK TO LEARNING JAVASCRIPT.
I couldn't wait to learn it anymore, so I did.
Of course, I am being reminded how tiring learning coding is.
(P.S. The title is from one of my favourite Lana songs that I always listen to when I am coding).
Functions in JavaScript
I was doing great until I came across frigging parameters. ARRRGH. Why do they have to be so confusing?
- What does it mean that "Arguments can be passed to the function as values or variables?"
- What does it mean the "The values that are passed to the function when it is called are called arguments?"
- What does it mean that "The parameters are specified between the parenthesis [...] and inside the function body, they act just like regular variables?"
ARRRGH.
Ohhhh. I frickin' see
Oh. I get it now I get it I finally get it.
You put in the PARAMETERS without saying exactly what they are when you DECLARE a function.
You specify what the frickin' parameters actually are when you CALL the function.
Arguments
Oh so I see. The arguments are the values that you give the function. But not when you declare it. Only when you CALL the function.
Only when you CALL it.
Oh wait what?
You can actually assign variables FIRST and then put the variables straight in when you CALL THE FUNCTION?
Wait so then WHY DO YOU NEED TO PUT IN THE PARAMETERS IN BOTH THE PARENTHESES AFTER THE IDENTIFIER AND THE FUNCTION ITSELF WHEN YOU DECLARE A FUNCTION?
To take the example from Codecademy:
- With name as a parameter, it can be used as a variable in the function body of sayThanks()
You DO have to put the parameters twice in the function declaration - once in the IDENTIFIER, and once in the FUNCTION BODY.
Meh. Easy.
Picture
I miss Brighton. Would you believe it? I spend the majority of my time missing Luxembourg, pining after it and all. But now that I'm back here, and I've been back here for a bit, I'm actually MISSING BRIGHTON. Still it could be helpful in finding out what my favourite parts are. E.g. I miss the Shoreham Port bit, near Portslade.
I miss Hove Lagoon! I miss walking between the two aforementioned areas.
Still I love where I am; no chance of any crazy hikes though like I normally like to do as I've been in resting nearly all holiday due to a leg injury.
So above is an image (from online) of one of the absolutely crazy awesome hikes that I like to do - it is the Top of the magical Hill (/plateau) that I live on.
I love it up there - everything up there is so so magical. SO SO SO SO MAGICAL.
Like I have legit heard silence up there.
Have you ever heard silence before? Like actual silence? It's BEAUTIFUL.
In javascript (and many other languages) functions are values (technically known as first class functions) so you can pass functions to other functions. That's where the fun begins :D
ReplyDeleteoh nooooooooo! 😂 you'll have to explain this to me more when I see you again. That sounds so hard! P.S. If I don't speak to you before then Happy New Year, and have a great NYE 😃😃
Delete