JavaScript to find the sum of two numbers entered by the user

In this program, you will learn how to find the sum of two numbers entered by the user in JavaScript.


let x = prompt("Enter first number")
let y = prompt("Enter second number")

JavaScript Program to display the sum of two numbers

Example: How to find the sum of two numbers entered by the user in JavaScript

let x = prompt("Enter first number")
let y = prompt("Enter second number")

let z = parseInt(x)+ parseInt(y)

console.log('Sum is:'+z)

Output:

Enter first number> 10
Enter second number> 20
Sum is:30