How to Make a Simple Addition App Using JavaScript

Open your text editor., Type in the code: var firstNumber = prompt("Enter First Number"); var secondNumber = prompt("Enter Second Number"); var total = Number(firstNumber) + Number(secondNumber); alert(total); , Save., Test it out.

3 Steps 1 min read Easy

Step-by-Step Guide

  1. Step 1: Open your text editor.

    Windows users can do this by typing "notepad" into the Run command box.

    Mac users should find TextEdit either in their Application Dock or Applications Folder.
  2. Step 2: Type in the code:<html> <head /> <body> <script> var firstNumber = prompt("Enter First Number"); var secondNumber = prompt("Enter Second Number"); var total = Number(firstNumber) + Number(secondNumber); alert(total); </script> </body> </html>

    , Save the document as an html file by putting ".html" at the end of its name instead of ".txt".

    The name can be anything. , Test it out by finding the document and opening it in your web browser.
  3. Step 3: Test it out.

Detailed Guide

Windows users can do this by typing "notepad" into the Run command box.

Mac users should find TextEdit either in their Application Dock or Applications Folder.

, Save the document as an html file by putting ".html" at the end of its name instead of ".txt".

The name can be anything. , Test it out by finding the document and opening it in your web browser.

About the Author

F

Frances Hart

Specializes in breaking down complex cooking topics into simple steps.

27 articles
View all articles

Rate This Guide

--
Loading...
5
0
4
0
3
0
2
0
1
0

How helpful was this guide? Click to rate: