How to add two variables in JavaScript?

To add two variables in JavaScript, do this: var c = a + b.

You can use the + operator to add two variables.

Here's how you do it:

var variableOne = 5;
var variableTwo = 3;

var theSumOfOneAndTwo = variableOne + variableTwo;

console.log(theSumOfOneAndTwo); // 8