easy.math.half(numb)
easy.math.half() returns the half of the number passed as the argument
syntax:
easy.math.half(numb)
source code:
half(numb) {
return numb/2;
}
start and end:
arguments:
-
numb (number):
the number to be halved
returns:
numb/2
a number, being the "numb" argument divided by 2
example:
easy.document.search("#button").addEventListener('click', () => {
const response = window.prompt("please enter a number");
window.alert(`the half of ${response} is ${easy.math.half(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 half of the response is
combos:
none