I've wrestled with making this blog post(let alone my first one!).
I'll be briefly discussing global and block scopes, with more an emphasis on the block scope. Why did I wrestle(a match I clearly lost) with this? To me, seemingly to others but not myself, block scoping was a very basic component of JavaScript.
Look, I've visited global and block scopes before, in fact in a boot camp I left I was taught it. Do not ask me why but I did not understand it when it was taught. It may be I'm not good at soaking in ideas as I listen to them but rather need to be able to implement them at my speed. To that end, Codecademy has been a huge boost.
Here's a bit of code, the global scope is everything outside curly braces. Literally everything in the curly brackets is block scope.
Think of it this way, "const twitter = '@mynameissalah'" is an h1 tag & everything in curly brackets is the css for the h1. That is to say, the curly brackets much like the css both respectively add a functionality to the parent they are assigned to.
I hope this helps at least one person! I feel like I was the outlier who didn't understand this easily while others seemed to—until it clicked & it was wildly simple. I don't learn as easily as most people & if that's you as well, hi! Wishing you the best in your learning, be easy on yourself. :]
Top comments (4)
This is actually why a lot of bugs happen:
That will burn you down because what you think is:
But it's closer to
That's not entirely correct, but it can be helpful to think about it that way.
I didn't know spotify had a banner that could play on any website. I like it lol.
Yeah I was surprised seeing it, hadn’t before reading blog posts on here—figured might be a cool little thing to add. Probably going to do this for my future ones too!:p
Great! It looks like a really good idea , The reader can choose to play the song recomended by the writer while reading. I will try to follow this idea too when i start writing blog posts.