A function with parameters can have default values that are used when the caller does not provide a value for that parameter (by omitting the parameter or providing undefined). The default value does not have to be a static value. You can run JavaScript and use previous parameters of that function.

JavaScript
// "timestamp" has a dynamic default value
function logMessage(message, timestamp = Date.now()) {
  // ...
}
JavaScript
function someFunction(
  value,
  max = value.length,
  suffix = value.length > max ? "..." : ""
) {
  // ...
}

someFunction("hello") // max = 5, suffix = ""
someFunction("hello" 2) // max = 2, suffix = "..."
someFunction("hello", undefined, ".....") // max = 5, suffix = "....."