Fundamentals

JavaScript

Easy
15 min

JavaScript is primarily a browser-based programming language that allows websites to become more interactive. JavaScript is used, for example, on server side and in mobile applications, but in this module we focus only on the use of JavaScript in browsers. Every commonly used browser supports JavaScript, which is why most websites also use JavaScript to some extent, and this cannot be ignored if you want to learn the basics of web development.

JavaScript can be executed in a browser primarily in two different ways. Either by writing JavaScript directly into the HTML code, or as a separate file.

JavaScript within HTML code. This example displays an alert window to the user that says "Hello World!"

<html><head><title>JavaScript example</title><script>
      alert("Hello World!");
    </script></head></html>

JavaScript in its own file. The example in question does the same as the example above. The file alert.js contains the JavaScript code.

<html><head><title>JavaScript example</title><script src="alert.js"/>
  </head>
</html>

In the module, only a basic understanding of what JavaScript is and how it works is given. You can find more about JavaScript programming, for example, here.

hakatemia pro

Ready to become an ethical hacker?
Start today.

As a member of Hakatemia you get unlimited access to Hakatemia modules, exercises and tools, and you get access to the Hakatemia Discord channel where you can ask for help from both instructors and other Hakatemia members.