 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Checking Oddish and Evenish numbers - JavaScript
A number is Oddish if the sum of all of its digits is odd, and a number is Evenish if the sum of all of its digits is even.
We are required to write a function that determines whether a number is Oddish or Evenish. We should return true of Oddish values and false for evenish
Example
Following is the code −
const num = 434667; const isOddish = (num, sum = 0) => {    if(num){       return isOddish(Math.floor(num / 10), sum + (num % 10));    };    return sum % 2 === 1; }; console.log(isOddish(num));  Output
Following is the output in the console −
false
Advertisements
 