About 15,700,000 results
Open links in new tab
  1. JavaScript Program to Add Two Numbers - GeeksforGeeks

    May 8, 2024 · Adding two numbers using an arrow function in JavaScript involves creating a concise function syntax that adds parameters and returns the sum. Syntax: let addition = (a, b) => a + b;

  2. JavaScript Program to Add Two Numbers

    We use the + operator to add two or more numbers. Example 1: Add Two Numbers const num1 = 5; const num2 = 3; // add two numbers const sum = num1 + num2; // display the sum console.log('The sum of ' + num1 + ' and ' + num2 + ' is: ' + sum); Output. The sum of 5 and 3 is: 8

  3. JavaScript Arithmetic - W3Schools

    The addition operator (+) adds numbers: The subtraction operator (-) subtracts numbers. The multiplication operator (*) multiplies numbers. The division operator (/) divides numbers. The modulus operator (%) returns the division remainder. In arithmetic, the division of two integers produces a quotient and a remainder.

  4. JavaScript Program to Add Two Numbers - CodesCracker

    JavaScript Program to Add Two Numbers. In this article, you will learn and get code for the addition of two numbers in JavaScript. The program is created in the following ways: Simple JavaScript Code to Add Two Numbers; Add two numbers using a form and a text box. Receive input from the user one by one. Add two numbers in JavaScript

  5. JavaScript program to add two numbers - 3 different ways

    In this post, I will show you three different ways to write a program that adds two numbers in JavaScript. This is the basic way to add numbers in JavaScript. We will define two const values holding two numbers and add them using +. Below is the complete program: If you run it, it will print 3 as output.

  6. How to add two numbers in JavaScript using TextBox | Example code

    Feb 11, 2021 · You can add two textbox values and show the result of addition to into the 3rd textbox by pressing the button using JavaScript and HTML code. Add two numbers in JavaScript with textbox example. Complete HTML example code, where 2 Input textbox is for number and 3rd for show sum of first 2 textboxes.

  7. How to Add Two Numbers in JavaScript? 7 Programs - WsCube …

    Jan 13, 2024 · In this tutorial, we will learn how to add two numbers in JavaScript, along with code examples, output, and simple explanations. How to Add Two Numbers in JavaScript Dynamically? Below is a simple JavaScript program to add two numbers using the + …

  8. Addition of two numbers in JavaScript using functions | Example code

    Feb 10, 2021 · Create a simple function with parameters and use the + operator to add two or more numbers in the JavaScript function. This code snippet is used to find the sum of two integer numbers using the JavaScript function.

  9. javascript - How to add two numbers? - Stack Overflow

    Apr 30, 2013 · function Add(a,b) { var result = null; if (isNaN(a) || isNaN(b)) { alert("Please send the number"); return; } a = Number(a); b= Number(b); return a+b; }

  10. Add Two Numbers in Javascript (Simple Examples) - Code Boxx

    Sep 4, 2024 · To add 2 numbers in Javascript, get the values from the fields and parse them into integers before adding: var first = document.getElementById("FIRST").value; var second = document.getElementById("SECOND").value;

Refresh