What the old typeof dance was solving
Before ES6 reached Apps Script's V8 runtime (which happened in 2020), the only way to set a fallback value for an optional parameter was a guard at the top of the function body: `if (typeof prefix === 'undefined') prefix = '$';`. The `typeof` form was idiomatic because accessing an undeclared variable directly throws a ReferenceError, while `typeof undeclaredVar` safely returns the string `'undefined'`. For declared parameters, a simple `=== undefined` check is fine — the ReferenceError can't happen — but muscle memory kept the `typeof` form alive long after it was necessary.
With V8, you can write `function formatValue(value, prefix = '$', decimals = 2)` and skip the guard entirely. The runtime assigns the default when the argument is `undefined`: when the caller omits the argument, or explicitly passes `undefined`. That covers every internal call you make from other script functions.