An explicit input is information supplied directly to a function through an argument. In JavaScript, arguments are the explicit inputs, while other ways information enters—such as reading a global variable—are implicit inputs. Making inputs explicit reveals what a function needs and improves reuse and testability. section 4.7 section 4.10
Passing the cart explicitly
A function that reads shopping_cart hides one of its inputs. Change update_shipping_icons() to update_shipping_icons(cart), then pass shopping_cart at the call site. The function still performs UI actions, but its cart dependency is now visible. section 5.4
Use explicit inputs when extracting calculations or generalizing duplicated functions:
- Identify information entering through a global variable or another hidden dependency. section 4.7
- Add an argument, replace the hidden or hard-coded value in the function body, and update every caller. section 10.4 section 14.11
- Generalize repeated operations by exposing values such as field names, nested keys, or modifier functions as arguments. section 10.4 section 14.10
- For calculations, pair explicit inputs with return values instead of hidden mutation or other implicit outputs. section 4.10 section 4.7
From specialized functions to a reusable one
Replace setPriceByName(cart, name, price), setQuantityByName(), and similar functions with setFieldByName(cart, name, field, value). The field name becomes a first-class value that callers can pass and store. section 10.4

