Posts

What is Arithmetic operators?

Arithmetic operators take numerical values (either literals or variables) as their operands and return a single numerical value. The standard arithmetic operators are an addition (+), subtraction (-), multiplication (*), and division (/). console.log(2 + 3 – 1); // expected output: 4

Add Two Numbers with JavaScript

Add Two Numbers with JavaScript

Number is a data type in JavaScript which represents numeric data.

Now let’s try to add two numbers using JavaScript.

JavaScript uses the + symbol as an addition operator when placed between two numbers.

Example:

myVar = 5 + 10; // assigned 15

Change the 0 so that sum will equal 20.