About 3,200,000 results
Open links in new tab
  1. How do I use parseInt to add two numbers? - Stack Overflow

    Oct 11, 2016 · I'm supposed to use parseInt to add two numbers the user enters, then use my response object to send back the result and display output to the user. For instance, if the user …

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

    Apr 30, 2013 · Parse the strings as integers using parseInt(str, 10). Parse the strings as floating-point numbers using parseFloat(str). Cast the strings to numbers using the unary plus …

  3. javascript - Sum of two numbers with prompt - Stack Overflow

    Mar 28, 2014 · The simplest is: var a = +prompt("Enter first number"); var b = +prompt("Enter second number"); alert(a + b); but you can also do var a = Number(prompt("Enter first …

  4. JavaScript Program to Add Two Numbers

    We use the + operator to add two or more numbers. const num2 = 3; // add two numbers const sum = num1 + num2; // display the sum console.log('The sum of ' + num1 + ' and ' + num2 + ' …

  5. 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 = …

  6. JavaScript Program To Add Two Numbers - CodingBroz

    // Take user input var num1 = parseInt (prompt ("Enter first number: ")); var num2 = parseInt (prompt ("Enter second number: ")); // Add two numbers var sum = num1 + num2; // Display …

  7. Creating a Simple Calculator - JavaScript tutorial

    Jul 17, 2016 · We can create a simple calculator that adds two numbers. First we create a function that generates two random numbers that are less than 100 and converts them into …

  8. Adding Numbers in JavaScript - Stack Overflow

    Sep 25, 2016 · var num1 = parseInt(document.getElementById("firstNumber").value); var num2 = parseInt(document.getElementById("secondNumber").value); you have to define the variables …

  9. 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 …

  10. How to Add Two Numbers in JavaScript | by Sam Jones | Medium

    Sep 22, 2024 · I uninstalled jquery and jquery-basic-arithmetic-plugin, and installed add-two-numbers2. Then, I changed my code to this: const add = require('add-two-numbers2') function...

Refresh