-
Notifications
You must be signed in to change notification settings - Fork 0
/
kata.js
87 lines (60 loc) · 2.5 KB
/
kata.js
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
// #1
// String.prototype.isUpperCase = function () {
// let arr = this.split('');
// for (let i = 0 ; i < arr.length ; i++) {
// if (arr[i].toUpperCase() !== arr[i]) {
// return false;
// }
// }
// return true;
// }
// #2
String.prototype.isUpperCase = function () { return this == this.toUpperCase() }
console.log('c'.isUpperCase());
//, false, 'c is not upper case');
console.log('C'.isUpperCase());
//, true, 'C is upper case');
console.log('hello I AM DONALD'.isUpperCase());
//, false, 'hello I AM DONALD not is upper case');
console.log('HELLO I AM DONALD'.isUpperCase());
//, true, 'HELLO I AM DONALD is upper case');
console.log('ACSKLDFJSgSKLDFJSKLDFJ'.isUpperCase());
//, false, 'ACSKLDFJSgSKLDFJSKLDFJ not is upper case');
console.log('ACSKLDFJSGSKLDFJSKLDFJ'.isUpperCase());
//, true, 'ACSKLDFJSGSKLDFJSKLDFJ is upper case');
console.log('Hello World'.isUpperCase());
//, false, 'Hello World is not upper case');
console.log('hello world'.isUpperCase());
//, false, 'hello world is not upper case');
console.log('Hello world'.isUpperCase());
//, false, 'Hello world is not upper case');
console.log('hello World'.isUpperCase());
//, false, 'hello World is not upper case');
console.log('HELLO WORLD'.isUpperCase());
//, true, 'HELLO WORLD is upper case');
console.log('Bob walks his dog every day.'.isUpperCase());
//, false, 'Bob walks his dog every day. is not upper case');
console.log('BOB walks his dog every day.'.isUpperCase());
//, false, 'BOB walks his dog every day. is not upper case');
console.log('BOB WALKS HIS DOG EVERY DAY.'.isUpperCase());
//, true, 'BOB WALKS HIS DOG EVERY DAY. is upper case');
console.log('BOB WALKs HIS DOG EVERY DAY.'.isUpperCase());
//, false, 'BOB WALKs HIS DOG EVERY DAY. is not upper case');
console.log('#lovewins'.isUpperCase());
//, false, '#lovewins is not upper case');
console.log('#Lovewins'.isUpperCase());
//, false, '#Lovewins is not upper case');
console.log('#loveWins'.isUpperCase());
//, false, '#loveWins is not upper case');
console.log('#LoveWins'.isUpperCase());
//, false, '#LoveWins is not upper case');
console.log('#LOVEWins'.isUpperCase());
//, false, '#LOVEWins is not upper case');
console.log('#LoveWINS'.isUpperCase());
//, false, '#LoveWINS is not upper case');
console.log('#LOVEWINs'.isUpperCase());
//, false, '#LOVEWINs is not upper case');
console.log('#lOVEWINS'.isUpperCase());
//, false, '#lOVEWINS is not upper case');
console.log('#LOVEWINS'.isUpperCase());
//, true, '#LOVEWINS is upper case');