Hello, here i have tried to keep my <script> as simple as possible to make a calculator and yeah i did some style using CSS.

Solution:

You can simply do that using : eval(variable);

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 str = "1-2+3*4";
console.log(eval(str));
Output : 11

Calculator using VANILLA JavaScript :

Here i have created a Function() which will check (parameter) value based on clicked button.

Like : If we click 1, then :
 document.getElementById("id").innerHTML += 1;

this will do the same for every button clicked.

But what will happen if there occurs any type of Miss Match ERROR ?

For that we used try{} catch(){};

then we will just simply do :

 document.getElementById("id").innerHTML = "ERROR";

Hope this will help you <3, if you have more simple solution? Then feel free to tell me via comment section.