Exercise 2: Purchase Items

Test your knowledge of passing multiple arguments to the function.

We'll cover the following

Problem statement

The purchaseItems() function merely prints the parameters it receives, after a little formatting.

Task 1

Two calls to the function are shown in the code widget’s exercise tab; this is given below. You are required to add the third function call in the code in such a way that it prints bread, milk, eggs, donuts, tea using the spread operator.

Exercise

Let’s implement a third call to the function so that it produces the desired result. The desired solution is available in the next lesson, but we want you to try to do it yourself.

Get hands-on with 1400+ tech skills courses.