Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const a = 10;
- const b = 33;
- function sum(a, b){
- return parseInt(a) + parseInt(b);
- }
- document.querySelector("#calculate").addEventListener("click", function(){
- let valueA = document.querySelector("#valueA").value;
- let valueB = document.querySelector("#valueB").value;
- if(valueA.length > 0 && valueB.length > 0){
- alert sum(valueA, valueB);
- }else{
- alert("Enter a value for to the calculation!");
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement