We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 81e0035 commit f48822fCopy full SHA for f48822f
beginner/ex10.js
@@ -0,0 +1,24 @@
1
+/*
2
+ * Have the function letterChanges(str) take the str parameter being passed and
3
+ * modify it using the following algorithm. Replace every letter in the string
4
+ * with the letter following it in the alphabet (ie. c becomes d, z becomes a).
5
+ * Then capitalize every vowel in this new string (a, e, i, o, u) and finally
6
+ * return this modified string.
7
+*/
8
+
9
+function LetterChanges (str) {
10
+ let alpha = 'abcdefghijklmnopqrstuvwxyz';
11
+ let newAlpha = 'bcdEfghIjklmnOpqrstUvwxyzA';
12
+ let answer = '';
13
14
+ for (let i = 0; i < str.length; i++) {
15
+ let index = alpha.indexOf(str[i]);
16
+ if (index !== -1) {
17
+ answer += newAlpha[index];
18
+ } else {
19
+ answer += str[i];
20
+ }
21
22
+ return answer;
23
+}
24
+console.log(LetterChanges("abc"));
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments