-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path04.1-built-in.html
More file actions
54 lines (45 loc) · 1.84 KB
/
04.1-built-in.html
File metadata and controls
54 lines (45 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Built-in Functions | Playground</title>
<script>
/*
---------------------------------------------------------
JavaScript Assignment
---------------------------------------------------------
TASK:
-----
1. This simple program asks the user to enter two numbers.
2. It multiplies the numbers and displays the result
directly on the webpage.
STUDENT ASSIGNMENT:
--------------------
Using this basic example, create a full calculator that
can perform ALL of the following operations:
1. Addition (+)
2. Subtraction (-)
3. Multiplication (*)
4. Division (/)
5. Modulus (%)
REQUIREMENTS:
--------------
1. Ask the user to enter two values.
2. Ask the user to choose which operation they want to perform.
3. Use if/else to perform the operation.
4. Display the final result on the page using document.write()
or (preferably) using HTML elements + innerHTML.
5. Make sure your calculator handles invalid input properly.
---------------------------------------------------------
*/
var numone = prompt("Enter First Value");
var numtwo = prompt("Enter Second Value");
var result = numone * numtwo; // multiplication
document.write("The result of multiplying: " + numone + " and " + numtwo + " is: " + result);
</script>
</head>
<body>
<!-- ... empty ... -->
</body>
</html>