JavaScript – Addition (+)

JavaScript Addition (+) Arithmetic Operator is used to perform arithmetic addition operation between two numbers, and return the result.

Addition Operator Symbol

The symbol used for Addition Operator is +.

Syntax

The syntax to use Addition Operator with operands is

</>
Copy
operand1 + operand2

Examples

In the following example, we take two numeric values and find their sum using Addition (+) Operator.

index.html

<!DOCTYPE html>
<html lang="en">
<body>
    <pre id="output"></pre>
    <script>
        var a = 4;
        var b = 3;
        var result = a + b;
        document.getElementById('output').innerHTML += a + ' + ' + b + '  is  ' + result;
    </script>
</body>
</html>

In the following example, we take two numeric values in exponential notation and find their sum using Addition (+) Operator.

index.html

<!DOCTYPE html>
<html lang="en">
<body>
    <pre id="output"></pre>
    <script>
        var a = 41e-2;
        var b = 121e-3;
        var result = a + b;
        document.getElementById('output').innerHTML += a + ' + ' + b + '  is  ' + result;
    </script>
</body>
</html>

Conclusion

In this JavaScript Tutorial, we learned about Arithmetic Addition Operator, its syntax, and usage with examples.