Search⌘ K
AI Features

Exercise 2: Purchase Items

Explore how to handle JavaScript function arguments by implementing calls using the spread operator and assigning default parameter values. Learn to reimplement functions to work correctly even when some arguments are missing, enhancing your skills in argument management.

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 ...