Answer:
A
Explanation:
I think is A. or maybe search up the topic of the lesson
Answer:
"A class that inherits from two classes"
Explanation:
If we're talking about Java, you can't extend from two classes. The reason for this is Java doesn't allow multiple inheritance.
The reason for this is to avoid the ambiguity caused by it. One of the cases where multiple inheritance can cause ambiguity is the diamond problem.
Diamond problem can occur if two classes (say B and C) inherit from one class (say A). And another class (say D) inherits from both B & C.
If B and C class override the same method from A class. And D class calls that method, which one will be called, class B's or C's??
The problem with the swap function is that it loses the value at the first index, as soon as it gets overwritten by the value at the second index. This happens in the first statement. To fix it, you need a helper variable.
First you're going to "park" the index at the first index in that helper variable, then you can safely overwrite it with the value at the second index. Then finally you can write the parked value to the second index:
var swap = function(array, firstIndex, secondIndex) {
let helper = array[firstIndex];
array[firstIndex] = array[secondIndex];
array[secondIndex] = helper;
};
I hope this makes sense to you.