"how to make a calculator websiteJS" Code Answer's

You're definitely familiar with the best coding language Javascript that developers use to develop their projects and they get all their queries like "how to make a calculator websiteJS" answered properly. Developers are finding an appropriate answer about how to make a calculator websiteJS related to the Javascript coding language. By visiting this online portal developers get answers concerning Javascript codes question like how to make a calculator websiteJS. Enter your desired code related query in the search bar and get every piece of information about Javascript code related question on how to make a calculator websiteJS. 

how to make a calculator websiteJS

By Powerful PonyPowerful Pony on Jun 27, 2020
let add =(...params) => {
    let sum = 0;
    params.forEach(el =>{
        sum = sum + parseInt(el);
    })
    return sum
}

document.querySelector('.add').addEventListener('click' , function (e) {
    const adder = document.querySelector('.addinput').value 
    const meow = adder.split(',')
    let result = add(...meow)
    if (isNaN(result)) {
        result = 'ENTER A NUMBER'
    }
    document.querySelector('.result').textContent = result
})

let times =(...params) => {
    let multiply = 1;
    params.forEach(el =>{
        multiply = multiply * el;
    })
    return multiply
}

document.querySelector('.multiply').addEventListener('click' , function (e) {
    const multiplier = document.querySelector('.multiplyinput').value 
    const moo = multiplier.split(',')
    let product = times(...moo)
    if (isNaN(product)) {
        product = 'ENTER A NUMBER'
    }
    document.querySelector('.product').textContent = product
})

let subtract =(...params) => {
    let diff = 0;
   diff = params[0] - params[1]
    return diff
}

document.querySelector('.subtract').addEventListener('click' , function (e) {
    const subtracter = document.querySelector('.subtractinput').value 
    const woof = subtracter.split(',')
    let diff = subtract(...woof)
    if (isNaN(diff)) {
        diff = 'ENTER A NUMBER'
    }
    document.querySelector('.difference').textContent = diff
})

let divide =(...params) => {
    let quotient = 0;
    quotient = params[0] / params[1]
    return quotient
}

document.querySelector('.divide').addEventListener('click' , function (e) {
    const divider = document.querySelector('.divideinput').value 
    const moo2 = divider.split(',')
    let quotient = divide(...moo2)
    if (isNaN(quotient)) {
        quotient = 'ENTER A NUMBER'
    }
    document.querySelector('.quotient').textContent = quotient
})

Add Comment

0

All those coders who are working on the Javascript based application and are stuck on how to make a calculator websiteJS can get a collection of related answers to their query. Programmers need to enter their query on how to make a calculator websiteJS related to Javascript code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about how to make a calculator websiteJS for the programmers working on Javascript code while coding their module. Coders are also allowed to rectify already present answers of how to make a calculator websiteJS while working on the Javascript language code. Developers can add up suggestions if they deem fit any other answer relating to "how to make a calculator websiteJS". Visit this developer's friendly online web community, CodeProZone, and get your queries like how to make a calculator websiteJS resolved professionally and stay updated to the latest Javascript updates. 

Javascript answers related to "how to make a calculator websiteJS"

View All Javascript queries

Javascript queries related to "how to make a calculator websiteJS"

Browse Other Code Languages

CodeProZone