Skip to content

Commit 8830b7b

Browse files
Wayleom Vargas RubioWayleom Vargas Rubio
authored andcommitted
lesson06 calc and stretch Wayleom Vargas
1 parent 088bcb8 commit 8830b7b

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
function isValidAlphaAbbreviation(word: string, abbr: string): boolean {
2+
if (word.length < 1 || word.length > 25 || abbr.length < 1 || abbr.length > 15) {
3+
return false;
4+
}
5+
6+
const hasNumbers = (str: string): boolean => /\d/.test(str);
7+
if (hasNumbers(word) || hasNumbers(abbr)) {
8+
return false;
9+
}
10+
11+
let wordIndex = 0;
12+
let abbrIndex = 0;
13+
14+
const letterToNumber = (char: string): number => {
15+
return char.charCodeAt(0) - 'a'.charCodeAt(0) + 1;
16+
};
17+
18+
19+
}
20+

0 commit comments

Comments
 (0)