Hello World - Your First Program
Let's get started with a very simple "Hello World" example in JavaScript! This is as simple as typing out the following code:
console.log("Hello World");
As you can see, we do not need to declare any import or dependency in order to be able to access the console.log() function - it is built into JavaScript's web APIs, enabling quick and easy access.
What we also see is our very first usage of a String - the "Hello World". Using console.log(), it is possible to print all datatypes to the console.
Usually, we not only want to print stuff into the console, but we rather want to return some kind of value - for example the result of a calulcation. This might look like the following:
return "Hello World";
Now, we do not print the text "Hello World" to the console, but instead return it - so any caller of this codeblock can then make use of this result!
Now it's on you - try to write your first program below!