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 corresponding element of a orb to the corresponding elements of c based on a flip of a coin. For example, if a coin is flipped HEADS, c[0] will be assigned the value of a[O), otherwise c[O] would be assigned the value of b[O]. Use Math.random() to generate a random number and designate <0.5 to be HEADS and >=0.5 to be TAILS. See examples below. The code segment below also calls a function printArray which prints the elements of an array in a vertical format.
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. DO NOT USE THE TAB TO INDENT. Use only spaces. Any violation of the academic integrity policies will receive a score of O for this problem.