how to make a calculator websiteJS
JavaScript
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
})
Also in JavaScript:
- Title
- Javascript check if undefinded
- Category
- JavaScript
- Title
- cannot add a child that doesn't have a yoganode touchablehighlight
- Category
- JavaScript
- Title
- drupal 8 node has field
- Category
- JavaScript
- Title
- how to add javascript to html
- Category
- JavaScript
- Title
- indexing string in javascript
- Category
- JavaScript
- Title
- iframe loader jquery
- Category
- JavaScript
- Title
- get youtube video id from url javascript
- Category
- JavaScript
- Title
- how to get the next item in map() js
- Category
- JavaScript
- Title
- event target javascript
- Category
- JavaScript
- Title
- graphql yoga access http headers
- Category
- JavaScript
- Title
- filtering json array in javascript
- Category
- JavaScript
- Title
- How to create a function in javascript
- Category
- JavaScript
- Title
- change the value in checkbox by button react
- Category
- JavaScript
- Title
- discord.js dm user
- Category
- JavaScript
- Title
- javascript .split().reverse.join
- Category
- JavaScript
- Title
- color in angular material not working
- Category
- JavaScript
- Title
- angular router return back
- Category
- JavaScript
- Title
- foreach over array javascript
- Category
- JavaScript
- Title
- href before onclick js
- Category
- JavaScript
- Title
- is checked checkbox jquery
- Category
- JavaScript
- Title
- export default react
- Category
- JavaScript
- Title
- how to draw a triangle using javascript
- Category
- JavaScript
- Title
- get caret index js
- Category
- JavaScript
- Title
- allow cross origin node
- Category
- JavaScript
- Title
- how to access global scope in to local scope using javascript examples
- Category
- JavaScript
- Title
- date object javascript
- Category
- JavaScript
- Title
- Javascript detect mobile browser
- Category
- JavaScript
- Title
- add element to body javascript
- Category
- JavaScript
- Title
- codemirror get object from textarea
- Category
- JavaScript
- Title
- how to delete an element from an array in javascript
- Category
- JavaScript
- Title
- append to array js
- Category
- JavaScript
- Title
- include javascript jquery file in html
- Category
- JavaScript
- Title
- create react app deployment heroku
- Category
- JavaScript
- Title
- angular themeable components
- Category
- JavaScript
- Title
- ionic cordova icon notification
- Category
- JavaScript
- Title
- Error: Can't resolve 'fs' webpack
- Category
- JavaScript
- Title
- get current screen name react navigation
- Category
- JavaScript
- Title
- get month in two digit in javascript date
- Category
- JavaScript
- Title
- how to loop audio in js
- Category
- JavaScript
- Title
- javascript alert
- Category
- JavaScript
- Title
- how to see if a web site is useing react
- Category
- JavaScript
- Title
- How do you call a functional component in React
- Category
- JavaScript
- Title
- addeventlistener on document in react js
- Category
- JavaScript
- Title
- firebase configuration on functions
- Category
- JavaScript
- Title
- Alternating Sums
- Category
- JavaScript
- Title
- functional component react
- Category
- JavaScript
- Title
- get current directory vbscript
- Category
- JavaScript
- Title
- how to take input in javascript in coding
- Category
- JavaScript
- Title
- how to add objects in array
- Category
- JavaScript
- Title
- how to open bash_profile
- Category
- JavaScript
- Title
- gitignore for angular
- Category
- JavaScript
- Title
- How to uninstall npm modules in node js?
- Category
- JavaScript
- Title
- how to set text for label in jquery
- Category
- JavaScript
- Title
- Heroku H10-App Crashed Error
- Category
- JavaScript
- Title
- call javascript function after page load complete
- Category
- JavaScript
- Title
- dynamic for loop react
- Category
- JavaScript
- Title
- check if javascript function is true
- Category
- JavaScript
- Title
- datatable after. draw
- Category
- JavaScript
- Title
- get last element of array javascript
- Category
- JavaScript
- Title
- getcollectionnames
- Category
- JavaScript
- Title
- array vowels js
- Category
- JavaScript
- Title
- add variable numerically in javascript
- Category
- JavaScript
- Title
- array javascript
- Category
- JavaScript
- Title
- how to use jQuery hide and show to display multiple images
- Category
- JavaScript
- Title
- convert jquery to string
- Category
- JavaScript
- Title
- how to change package name in react native
- Category
- JavaScript
- Title
- age calculator javascript
- Category
- JavaScript
- Title
- how to avoid inheritance in angular
- Category
- JavaScript
- Title
- empty a select input using js
- Category
- JavaScript
- Title
- javascript check if code is nodejs
- Category
- JavaScript
- Title
- how to Write a program that simulates a coin toss using random method of Javascript Math class
- Category
- JavaScript
- Title
- how to start react
- Category
- JavaScript
- Title
- create csv file javascript
- Category
- JavaScript
- Title
- capitalize first letter javascript
- Category
- JavaScript
- Title
- check if string contains substring javascript
- Category
- JavaScript
- Title
- how to import a json string from a file in typescript
- Category
- JavaScript
- Title
- convert string to datetime javascript
- Category
- JavaScript
- Title
- compare NaN in javascript if condititon
- Category
- JavaScript
- Title
- chart.js on hover and onclick event
- Category
- JavaScript
- Title
- javascript check for undefined
- Category
- JavaScript
- Title
- how to attach javascript to html
- Category
- JavaScript
- Title
- How to check whether a checkbox is checked in jQuery?
- Category
- JavaScript
- Title
- assign array to another array javascript
- Category
- JavaScript
- Title
- Inserting HTML elements with JavaScript
- Category
- JavaScript
- Title
- jacvascript parse float
- Category
- JavaScript
- Title
- check if message mentions users discord js
- Category
- JavaScript
- Title
- javascript check for null variables
- Category
- JavaScript
- Title
- how to push object in array using for loop javascript
- Category
- JavaScript
- Title
- elseif javascript
- Category
- JavaScript
- Title
- date add hours javascript
- Category
- JavaScript
- Title
- how to add class to element on mouseclick with js
- Category
- JavaScript
- Title
- index.js:1 Warning: <feGaussianBlur /> is using incorrect casing. Use PascalCase for React components, or lowercase for HTML elements.
- Category
- JavaScript
- Title
- get selected value of dropdown in javascript
- Category
- JavaScript
- Title
- javascript capitalize string
- Category
- JavaScript
- Title
- javascript add item to list
- Category
- JavaScript
- Title
- for loop in jquery array
- Category
- JavaScript
- Title
- file input disable open file picker javascript
- Category
- JavaScript
- Title
- javascript ascii to hex
- Category
- JavaScript
- Title
- google maps javascript api
- Category
- JavaScript
- Title
- get parent element using jquery
- Category
- JavaScript