How to use + Operator In Javascript
In this approach we add two numbers in JavaScript involves using the + operator to perform arithmetic addition on numeric variables, resulting in their sum.
Syntax:
x + y;
Example: In this example, we are adding two numeric values by using the + operator.
let num1 = 10;
let num2 = 10;
let sum = num1 + num2;
console.log("Sum :", sum);
Output
Sum : 20
JavaScript Program to Add Two Numbers
We will explore how to add two numbers in JavaScript. Adding two numbers in JavaScript means combining numeric values together using arithmetic addition, which gives us their total sum.
There are several methods that can be used to Add Two Numbers in JavaScript, which are listed below:
Table of Content
- Using + Operator
- Using function
- Using Arrow function
- Using Addition Assignment (+=) Operator
Contact Us