Answers for "Javascript Check if number is even or odd"

3

if odd js

function isEven(value) {
    return !(value % 2)
}
Posted by: Guest on September-02-2020
0

number is even or odd fucntion in javascript

<!DOCTYPE html>
<html>
<body>
<script>
   var num = 5;
   document.write("Number = "+num+"<br>");
   if(num % 2 == 0) {
      document.write('Number is even!');
   } else {
      document.write('Number is odd!');
   }
</script>
</body>
</html>
Posted by: Guest on November-29-2020
0

Javascript Check if number is even or odd

function solution(num) {
    return num % 2 === 0 ? 'Even' : 'Odd'
}
Posted by: Guest on July-10-2021

Code answers related to "Javascript Check if number is even or odd"

Code answers related to "Javascript"

Browse Popular Code Answers by Language