script.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. function calc(){
  2. var result
  3. var a = Number(document.getElementById("numb1").value);
  4. var b = Number(document.getElementById("numb2").value);
  5. var act = String(document.getElementById("act").value);
  6. switch (act){
  7. case "plus":
  8. result = a + b
  9. break;
  10. case "min":
  11. result = a - b
  12. break;
  13. case "multiply":
  14. result = a * b
  15. break;
  16. case "division":
  17. result = a / b
  18. break;
  19. default:
  20. result = 'unknow'
  21. }
  22. document.getElementById("result").innerHTML = result.toFixed(2);
  23. return
  24. }
  25. let massiv = []
  26. function gets(){
  27. massiv.push(document.getElementById("pushInp").value);
  28. document.getElementById("mass").innerHTML = massiv
  29. return
  30. }
  31. function sets(){
  32. var intf = document.getElementById("setNumb").value;
  33. massiv.splice(intf,intf+1);
  34. document.getElementById("mass").innerHTML = massiv
  35. return
  36. }
  37. function proCalc(){
  38. var numb = eval(document.getElementById("number").value);
  39. document.getElementById("resultat").innerHTML = numb.toFixed(2);
  40. }