Hello World!!

At the beginning of every language or markup we learn, we must encounter these two words “Hello world” I sometimes wonder why🤷‍♀️. Well, it's time to say hello to the big amazing world in the beautiful language of JavaScript. but first, let’s learn

  • What Javascript is,

  • how to set up our workspace,

What is javascript?

JavaScript is a scripting or programming language that allows you to implement complex features on web pages it allows us to dynamically create and update content, control multimedia, animate images, that not only interacts with visitors but also executes complex actions. It in effect adds magic to a website.

Programs in javascript are called scripts and can be written in HTML documents and loaded as the document loads on the browser . These scripts are also written in plain text.

How to set up our workspace

The HTML <script> tag is used to link javascript to the HTML document. Javascript can be written in the HTML document and be run as the browser loads the document. for this, the Javascript code would go between the script tag and load with the HTML document

A javascript document can also be linked by the script tag The link to the script file can be attached toward the end of the HTML document, just above the close of the body tag with the value of the src set to the relative or absolute paths to the JS file or in the head tag.

If the amount of Javascript files to be added to the HTML is much, it's best practice to add a new JS file for it rather than write between script tags in the HTML page this is because the browser will download it and store it as a cache so if reference is made to that JS file from other pages it’ll go to the cache instead of downloading multiple times.

Note: If the script tag is used to link to a new JS file then any code written in between the script tags will be ignored that is because all JavaScript code will be taken from the referenced JS file.

now we know how to set up our workspace either we link to an external document or write in our HTML document. whichever you choose is totally up to you but it is best practice to link to an external document. In my next post, we will discuss the basics of javascript and some basic commands in this exciting programing language. till then, stay safe, spread love, and have fun toodles👋.