A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/javascript/addition-arithmetic-operator-in-javascript/ below:

JavaScript Addition (+) Operator - GeeksforGeeks

JavaScript Addition (+) Operator

Last Updated : 19 Sep, 2024

JavaScript addition (+) operator is one of the most fundamental and widely used arithmetic operators in JavaScript. It is used to perform arithmetic addition on numbers but also concatenate strings.

Syntax
a + b

Where -

Return Type: It returns the sum/concatenation of numbers/strings.

Example 1: In this example, we will use the addition operator on some primitive data types and check their equivalent sum.

JavaScript
console.log(1 + 2);
console.log(NaN + 1);
console.log(true + 1);
console.log(false + 1);

Example 2: In this example, we will use the addition operator to perform concatenation

JavaScript
console.log("1" + 2);
console.log("Hello " + "Geek");
Supported Browser

We have a complete list of Javascript Arithmetic operators, to check those please go through this JavaScript Arithmetic Operators article.



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4