0 of 8 problems solved • 0%
Use in a course

Parameters and Return Values

8 exercisesEasy

Parameters let one function work with different inputs, and return sends a result back to the caller. That result can be stored, combined, or passed into another function.

function priceWithTax(price, taxRate) { return price * (1 + taxRate); } const finalPrice = priceWithTax(80, 0.25); console.log(finalPrice); // 100

Practice passing arguments, working with several parameters, and using returned values in later calculations. Logging displays information; returning makes information reusable—an important distinction when functions begin working together.