Even or Odd | JavaScript (solved) | codewars
Even or Odd in JavaScript (Solved) Create a function that takes an integer as an argument and returns "Even" for even numbers or "Odd" for odd numbers. Solution function even_or_odd(number) { return number % 2 ? "Odd" : "Even"; } Even Numbers Any integer that can be divided exactly by 2 is an even number . The last digit is 0, 2, 4, 6 or 8 Example: −24, 0, 6 and 38 are all even numbers Odd Numbers Any integer that cannot be divided exactly by 2 is an odd number . The last digit is 1, 3, 5, 7 or 9 Example: −3, 1, 7 and 35 are all odd numbers Odd numbers are in between the even numbers. Integers Integers are like whole numbers, but they also include negative numbers ... but still no fractions allowed! So, integers can be negative {−1, −2,−3, −4, ... }, positive {1, 2, 3, 4, ... }, or zero {0} We can put that all together like this: Integers = { ..., −4, −3, −2, −1, 0, 1, 2, 3, 4, ... } Examples: −16, −3, 0, 1 and 198 are a...