aboutsummaryrefslogtreecommitdiff
path: root/challenge-001/zapwai/javascript/ch-1.js
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-001/zapwai/javascript/ch-1.js')
-rw-r--r--challenge-001/zapwai/javascript/ch-1.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/challenge-001/zapwai/javascript/ch-1.js b/challenge-001/zapwai/javascript/ch-1.js
new file mode 100644
index 0000000000..0ab10904ef
--- /dev/null
+++ b/challenge-001/zapwai/javascript/ch-1.js
@@ -0,0 +1,14 @@
+let str = "Perl Weekly Challenge!";
+let cnt = 0;
+let newstr = "";
+for (let c of str) {
+ if (c == "e") {
+ c = "E";
+ cnt++;
+ }
+ document.write(c);
+ newstr += c;
+}
+console.log(newstr);
+document.write("\n<br>There were ", cnt, " e's in the sentence.");
+console.log("\nThere were ", cnt, " e's in the sentence.");