What is JavaScript?

JavaScript is a front end scripting languages used to give webpages functionality and more dynamic capabilities. Using JS (JavaScript) you can add events that happen when someone clicks a button your webpage, or animate elements of a page, redirect users, and much more.

You can include JS code within a ‘.html’ page by using an opening and closing script tag. Within the script tags you write the code to be executed. The ‘console.log’ function simply just writes a message to the developer console in the browser. This code will be executed as soon as the page loads.

    console.log("Hello World");

Externally JavaScript code can help organise your scripts easier. To import a script into a ‘.html’ page you use an opening and closing tag, but instead of putting the code inside the tags you add the ‘src’ attribute and include a path to the ‘.js’ file. The ‘.js’ file will contain all the JavaScript code you want to be executed.

<script src="myScript.js"></script>

There is a lot of functionality you can add to a webpage, or website, using JavaScript. There are entire frameworks built using JavaScript to allow you to quickly and easily create webapps, mobile apps, games, etc. It can be powerful if used correctly.

Leave a Reply