Variable and parameter names coincidence in JavaScript

Function parameters are local variables within it. Let's name the function parameter with the same name as the external global variable:

javascriptfunction func(num) {
  console.log(num);
}

let num = 1;
func(num);

In this case, it will turn out that there will be the variable num outside the function and variable num inside the function. But these will be different variables: changing a variable inside a function will change the local variable of the function. And the external variable inside the function will be inaccessible and cannot be changed in any way. Let's check:

javascriptfunction func(num) {
  num = 2; // change local variable
}

let num = 1;
func(num);
console.log(num); // shows 1 - nothing has changed
Задание 1

Determine what will be output to the console without running the code:

javascriptfunction func(num) {
  num = 2;
}

let num = 1;
func(num);
console.log(num);
Задание 2

Determine what will be output to the console without running the code:

javascriptfunction func() {
  num = 2;
}

let num = 1;
func();
console.log(num);
Задание 3

Determine what will be output to the console without running the code:

javascriptfunction func() {
  let num = 2;
}

let num = 1;
func();
console.log(num);