Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function calcEval(n1,n2,act) {
- if (act == "^") {
- if (n1 == 0) {
- var result = "Недопустимое действие"
- return;
- }
- else
- var result = "Math.pow(" + n1 + "," + n2 + ");"
- }
- else
- if (act == "/" && n2 == 0)
- var result = "Недопустимое действие";
- else
- var result = n1 + act + n2;
- document.querySelector("#res2").innerHTML = eval(result);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement