1. How can you create a function in Javascript?
You can create a function by writing the function keyword to hold a function value:
const triValue(a, b, c) {
return a * b * c;
}
You can declare a binding to give a function as a value:
function beFunction(f, g, h) {
return f + g - h * 2;
}
Or you can write a more simple arrow function:
let plusTen = numb => numb + 10;
2. What is the difference between var and let in regards to scope?
A binding declared with let is local to the block, so you can not see it outside that block. On the other hand, a binding declared with var can be visible outside its block code.
3. What is a pure function? It is a function that has no side effects and doesnât rely on side effects from other code.