Skip to main content

Create JavaScript function for basic arithmetic operations (Addition, Subtraction, Multiplication and Division). Create proper design layout which asks two numbers to enter from user and display result of respective operation on clicking respective button.

The tags used were:

1.form: The HTML form element defines a form that is used to collect user input

2.inputThe input tag specifies an input field where the user can enter data.
input elements are used within a form element to declare input controls that allow users to

input data.
Java Script Function:
eval function: The eval() function evaluates or executes an argument.
If the argument is an expression, eval() evaluates the expression. If the argument is one or more 
JavaScript statements, eval() executes the statements.
Example:
var x = 40;
var y = 20;
var a = eval("x * y";
var b = eval("3 + 7";
var c = eval("x + 7");
var res = a + b + c;
Screenshots:




Comments