-
Notifications
You must be signed in to change notification settings - Fork 0
/
qno43.js
17 lines (17 loc) · 988 Bytes
/
qno43.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
"use strict";
// Qno.43
// Unchanged Magicians: Start with your work from Exercise 40. Call the function make_great() with a copy of the array of magicians’ names. Because the original array will be unchanged, return the new array and store it in a separate array. Call show_magicians() with each array to show that you have one array of the original names and one array with the Great added to each magician’s name.
Object.defineProperty(exports, "__esModule", { value: true });
function show_Magician(magicians_name) {
magicians_name.forEach(name => console.log(name));
}
function make_Great(magicians_name) {
return magicians_name.map(name => `The Great ${name}!`);
}
let magician_Name = ["David Blaine", "Teller", "Harry Houdini"];
let copy_magician_Name = magician_Name.slice();
let copy_great_magician = make_Great(copy_magician_Name);
console.log("ORIGINAL ARRAY!\n");
show_Magician(magician_Name);
console.log("\nCOPIED ARRAY!\n");
show_Magician(copy_great_magician);