Parameter-object in JavaScript

Objects, unlike primitives, are passed by reference. This means that changing an object inside the function will cause it to change outside the function as well. See an example:

javascriptfunction func(arr) {
  arr[0] = '!';
}

let arr = [1, 2, 3];
func(arr);
console.log(arr); // shows ['!', 2, 3]
Задание 1

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

javascriptfunction func(obj) {
  obj.a = '!';
}

let obj = {a: 1, b: 2, c: 3};
func(obj);
console.log(obj);
Задание 2

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

javascriptfunction func(arg) {
  arg = '!';
}

let obj = {a: 1, b: 2, c: 3};
func(obj.a);
console.log(obj);
Задание 3

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

javascriptfunction func(obj) {
  obj = '!';
}

let obj = {a: 1, b: 2, c: 3};
func(obj.a);
console.log(obj);
Задание 4

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

javascriptfunction func(arr) {
  arr.splice(1, 1);
}

let arr = [1, 2, 3];
func(arr);
console.log(arr);
Задание 5

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

javascriptfunction func(arr) {
  arr.slice(1, 1);
}

let arr = [1, 2, 3];
func(arr);
console.log(arr);
Задание 6

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

javascriptfunction func(arr) {
  let newArr = arr;
  newArr[0] = '!';
}

let arr = [1, 2, 3];
func(arr);
console.log(arr);