There was an error while loading. Please reload this page.
1 parent d9b1f22 commit d9bccbbCopy full SHA for d9bccbb
8_Is-Digit/index.js
@@ -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