Sample output
Made on 27 October 2026
add(a, b)
Adds two values using JavaScript’s + operator.
Parameters
| Name | Type | Constraints |
|---|---|---|
a |
any |
None. If either operand is a string, string concatenation may occur. |
b |
any |
None. If either operand is a string, string concatenation may occur. |
Returns
any — The result of evaluating a + b.
Errors
This function does not explicitly throw errors. JavaScript may throw a TypeError for incompatible operand types, such as mixing a bigint with a number.
Example
const result = add(2, 3);
console.log(result); // 5