Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. const a = 10;
  2. const b = 33;
  3.  
  4. function sum(a, b){
  5. return parseInt(a) + parseInt(b);
  6. }
  7.  
  8. document.querySelector("#calculate").addEventListener("click", function(){
  9. let valueA = document.querySelector("#valueA").value;
  10. let valueB = document.querySelector("#valueB").value;
  11.  
  12. if(valueA.length > 0 && valueB.length > 0){
  13. alert sum(valueA, valueB);
  14. }else{
  15. alert("Enter a value for to the calculation!");
  16. }
  17. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement