Var declarations can be either globally scoped or function scoped. It is globally scoped if the var variable is declared outside a function can be used anywhere in the whole window. The var is function scoped when it is declared within a function and be used only inside the function.
#Declaring variable var
var greeter = ‘hi’
const are the variables declared with the const and can maintain only constant values. Const declarations can only be accessed inside the block only where it was declared.
#Declaring const
const greeting = ‘hi’
The main difference between var and const is var can be re-declared and updated and const cannot be re-declared or updated.
If you want to learn Node Js from an online course, you can register for this Node Js Course by Intellipaat
Also, watch this video on Node Js: