Traditionally JavaScript has been used only in the front end, so the code was loaded to the browser and executed there. But in the late-2000s Node.js was created and that made possible to use it also in the back end.
In the examples of this tutorial there is no need to deeply learn JavaScript, so I will mention here only those things that might seem strange, if you haven't been studying JavaScript.
You can use keywords var, let and const, when you are introducing JS-variables. The difference between those is that:
Callbacks are functions which are passed as an argument to some other function. You will need them when you are using some asynchronous functions.
Here is an example which demonstrates the callback system:
setTimeout(doSomething,2000); function doSomething(){ console.log("Demonstrating the callbacks"); } console.log("The application is started");Here the function setTimeout has two parameters: function doSomething and delay. So, we will pass the function doSomething as an argument to the setTimeout function. So now the function doSomething is the callback.
And because setTimeout is asynchronous function the application is not blocked and thats why the console.log("The application is started") will appear first.
Quite often the previous example is made like this
setTimeout(function(){ console.log("Demonstrating the callbacks"); },2000); console.log("The application is started");So, now the callback function don't need a name and we can say that it is an anonymous function.
Arrow functions makes the code shorter, but also harder to read (at least for starters).
We can replace the previous code with this
setTimeout(()=>{ console.log("Demonstrating the callbaks"); },2000); console.log("The application is started");
Here is a short article about callbacks https://www.freecodecamp.org/news/javascript-callback-functions-what-are-callbacks-in-js-and-how-to-use-them/