Skip to content

Commit c3da503

Browse files
Added isOdd function. (TheAlgorithms#454)
* Added isOdd function. Co-authored-by: vinayak <itssvinayak@gmail.com>
1 parent 8af29b9 commit c3da503

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Maths/isOdd.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*
2+
* function to check if number is odd
3+
* return true if number is odd
4+
* else false
5+
*/
6+
7+
const isOdd = (value) => {
8+
return !!((value & 1))
9+
}
10+
11+
// testing
12+
console.log(isOdd(2))
13+
console.log(isOdd(3))

0 commit comments

Comments
 (0)