Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

JavaScript Forloop

//multiplying a given number by eight if it is an even number and by nine otherwise.

function simpleMultiplication(number) {
  if (number % 2 === 0) {
    return number * 8;
  } else {
    return number * 9;
  }
}
Source by www.codewars.com #
 
PREVIOUS NEXT
Tagged: #JavaScript #Forloop
ADD COMMENT
Topic
Name
5+2 =