Parameter
↔ Variable pass into function to define Function Signature, imports Arguments & act as local variable
aka Param
!differs vs Argument which only the value itself entering function - and not a name used to define function
!differs vs Argument which is what Parameter will initialize into, if supplied
Parameter Default Value
JS Syntax used to specify default Value for a Parameter if not provided
References
function
↔ JS Keyword to Declare function (with optional Argument Parameters)Parameter Default Value
↔ JS Syntax used to specify default Value for a Parameter if not providedTyped Optional Parameter
↔ TS Syntax to mark Identifier as an optional Parameter using?:
--noImplicitAny
↔ to flag TSC to prevent Type Inference forany
- enforce explicit Type for Parameter, Exception, etcType Assignment
↔ code to assign Type to Variable/Parameter using:
assert.throws()
↔assert
Static Method to complain if Callback Function Parameter does not throw Exception"noImplicitAny": true
↔ tothrow
Exception when any Parameter inferred asany
"noUnusedParameters": true
↔ to warn/throw when function Parameter unused (inside function)Lazy Initial value
↔ function pass as Parameter intouseState()
, to assignreturn
value as Initial State value, on first-call onlyuseToggle()
↔ Custom Hook to flipboolean
ParamRangeError
↔ Exception whennumber
|| Param outside valid range