Collecting Artifacts for a Museum Exhibit

You are a curator at a museum tasked with preparing a new exhibit. The exhibit will feature a pair of rare artifacts that need to be displayed together. To organize the artifacts, you need to create a function that collects two artifact names and returns them as an array.

Write a function named collectArtifacts that takes two parameters:

  • artifact1: A string representing the name of the first artifact.

  • artifact2: A string representing the name of the second artifact.

The function should return an array containing these two artifact names.

Example 1

Input: collectArtifacts("Dinosaur Fossil", "Medieval Sword");
Output: ["Dinosaur Fossil", "Medieval Sword"]

Example 2

Input: collectArtifacts("Space Shuttle Model", "Moon Rock");
Output: ["Space Shuttle Model", "Moon Rock"]

Example 3

Input: collectArtifacts("Renaissance Painting", "Pharaoh's Mask");
Output: ["Renaissance Painting", "Pharaoh's Mask"]

Are you stuck on this problem?

Get detailed, step-by-step solution and improve your JavaScript skills.

  • Detailed Explanation: Each solution comes with a comprehensive explanation, helping you understand the logic and concepts thoroughly.
  • Learn to Write Better Code: Even if you have written the code, discover ways to improve it and adopt best practices.
  • Save Time: Don’t waste hours struggling—get the solution and learn efficiently.
  • Lifetime Access: Get access to lifetime solutions for all problems available
Get the Solution

" I struggled with this problem for hours, but the solution provided here was clear and easy to follow. It helped me understand where I went wrong and improved my coding skills significantly." - Jane D.

If you're not satisfied, I offer a 7-day money-back guarantee.