easy.math.double(numb)
easy.math.double() returns the double of the number passed as the argument
syntax:
easy.math.double(numb)
source code:
double(numb) {
return numb*2;
}
start and end:
arguments:
-
numb (number):
the number to be doubled
returns:
numb*2
a number, being the "numb" argument multiplied by 2
example:
easy.document.search("#button").addEventListener('click', () => {
const response = window.prompt("please enter a number");
window.alert(`the double of ${response} is ${easy.math.double(response)}`);
});
the example above...
- adds a click event listener to an element with "button" id (see easy.document.search(query) f)
- upon clicked, a prompt is triggered under a const named "response", politely asking the user to enter a number
- after the prompt is closed, an alert opens, telling what the double of the response is
combos:
none