Handlebar Helper Function: Fallback

Returns the second argument (fallbackValue) if the first argument is null, an empty string, or if an exception occurs in code nested within the fallback helper. Otherwise, it returns the first argument.

ParameterTypeDescription
valueanyRequired. The primary value to check.
fallbackValueprimitiveRequired. The static value to use if the primary value is null or an exception occurs. Must be a boolean, character, byte, short, integer, long, float, double, or string.

If value is null, is an empty string, or is an expression that throws an exception, the function returns fallbackValue. Otherwise, it returns the value of the value parameter.

If the value of the fallbackValue parameter isn't a primitive type (for example, if it's an array or object), the function throws an exception.