Have I Got This Right?

Have I Got This Right?

Part 1: JavaScript

This will either be a fantastic idea and I'll actually get some sort of blogging routine out of it, or it will be a complete flop. Either way, I am fully convinced writing about what I learn (or have learned within the last few months in this case) will cement the knowledge in my head.

I won't go into the back story of my introduction to the web dev world, maybe I'll do that in another post. Even just typing this gibberish feels good, like I'm cleansing my mind of my thoughts. But enough of that, let's get down to business...

Have I Got This Right?

Each week (hopefully), I am going to write about a certain topic within web development that I have been learning about. My hope is that this will give me more confidence in what I have learned just by writing about it, and maybe I can help some others along the way!

This week, I'm blabbering about...

JavaScript!

Now I understand JavaScript can be a very broad area, but I am a new guy, so I just want to cover the basics. Let's go!

What is JavaScript?

JavaScript is one of the core languages involved in web development, alongside HTML and CSS. JavaScript adds the interactivity element, taking websites from (boring) static pages to fancy, dancing creations!

If I understand it correctly, APIs (Application Programming Interfaces) play a huge role in the use of JavaScript today. They take my 'dancing creations' analogy above straight to being 'superheros'. I can't go into more detail about APIs though, I'm a long way off that.

JavaScript can either be inserted directly within an HTML document or linked to the HTML document. From what I understand, the general preference of web developers is to link your JS file, rather than populate your HTML file with a mixture of HTML and JS (the same applies with CSS).

JavaScript is also best served at the end of the loading queue. This can be done by deferring the JS until after the rest of the HTML document has been processed:

<head>
...
  <script src="script.js" defer></script>
...
</head>

'defer' is the keyword there! One thing I need clarity on: can this be inserted in the head of the document? I have often seen JS inserted at the end of the body element, but I also understand that is considered old-fashioned. Thoughts?

I shall finish this post here! Not much this time because I blabbered on at the start, but I shall return to continue on this. I have a lot to learn, but with more learning comes more confidence and more knowledge to attempt some little side-projects!

Be sure to follow me on Twitter where I promise to try and be more active and interesting...

Did you find this article valuable?

Support Adam Percival by becoming a sponsor. Any amount is appreciated!