Skip to content

Commit d9bccbb

Browse files
committed
Is Digit
1 parent d9b1f22 commit d9bccbb

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

8_Is-Digit/index.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Is Digit
2+
// Write a function that takes in a STRING and returns a boolean on whether or not it is a digit. A digit is defined as a number between 0-9
3+
4+
const isDigit = str => {
5+
if (str.length !== 1) return false
6+
return '0123456789'.includes(str)
7+
}
8+
9+
console.log(isDigit('16'))
10+
console.log(isDigit('6'))
11+
console.log(isDigit('d'))

0 commit comments

Comments
 (0)