title


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:

  1. 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...

  1. adds a click event listener to an element with "button" id (see easy.document.search(query) f)
  2. upon clicked, a prompt is triggered under a const named "response", politely asking the user to enter a number
  3. after the prompt is closed, an alert opens, telling what the half of the response is

combos:

none



see also:

  1. easy.math.double(numb) f
  2. easy.document.search(query) f