The JavaScript code segment below calls a function magicArray that has three array parameters a b and c of the same length. The function is intended to assign the smaller of the corresponding elements in arrays a and b to the corresponding elements of c For example, if
a and b then c because If the two items compared are equal, either
can be assigned to array c The code segment below also calls a function printArray which prints the elements of an array in a vertical format. You can assume that the arrays have the same number of elements. Your code should work as intended for arrays of any size.
function magicArray a b c
Missing Code
function printArray arr
Missing Code
Program Run
Array a:
Example
Arrav a
var a new Array;
var b new Array;
var c new Array;
magicArray a b c;
document.write "Array a:
;
printArray a;
document.writeArray b:
;
printArray b;
document.write Array c:
;
printArrayc;
Arrav b
Array c
Array b:
Array c:
Example
Array a
Array b
Array c
In the textbox below, you are to type the code for the two functions magicArray and printArray so that they work as intended as shown in the above program run and examples.