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 05537c9 commit a02c534Copy full SHA for a02c534
index.js
@@ -82,3 +82,19 @@ const result = wordArray.filter((word) => word === "et").length;
82
console.log(result);
83
84
// Bonus 2
85
+
86
+function checkPalindrome(phrase) {
87
+ const phraseClean = phrase.toLowerCase().replace(/[^a-zA-Z]/g, "");
88
+ let phraseCleanReverse = "";
89
+ for (let i = phraseClean.length - 1; i >= 0; i--) {
90
+ phraseCleanReverse += phraseClean[i];
91
+ }
92
+ if (phraseClean === phraseCleanReverse) {
93
+ return true;
94
+ } else {
95
+ return false;
96
97
+}
98
99
+// console.log(checkPalindrome("Amor, Roma"));
100
+console.log(checkPalindrome("A man, a plan, a canal, Panama!"));
0 commit comments