-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupOrLowCase.js.js
More file actions
31 lines (22 loc) · 788 Bytes
/
Copy pathupOrLowCase.js.js
File metadata and controls
31 lines (22 loc) · 788 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/**
* -------------------------------------------------------
* Programming Question : UpperCase Or LowerCase
* -------------------------------------------------------
**/
// Q. Write a function to check if a character is uppercase or lowercase.
//constraint
// The input char will be a single character.
// The character can be any printable ASCII character.
// You can assume that the input will always a string of length 1.
function isUpOrLowCase(char) {
// if(char.charCodeAt(0) >= 41 && char.charCodeAt(0)<= 91){
// return true
// }
// return false;
// if(char.charCodeAt(0) >= 61 && char.charCodeAt(0)<= 122){
// return true
// }
return char === char.toUpperCase();
}
console.log(isUpOrLowCase("b"));
console.log(isUpOrLowCase("B"));