Skip to content

Commit

Permalink
commit tree f7f4c8367fc59061221b4c07e3714ce898a7bd44
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentLangat033 committed Jun 17, 2022
1 parent 32f19a2 commit cef03ba
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
27 changes: 26 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,34 @@
function reverseString(word) {
// create an array from the input string
const wordArray = word.split("");
// reverse the array
const reversedWordArray = wordArray.reverse();
// create a string from the reversed array
const reversedWord = reversedWordArray.join("");
// return the reversed string
return reversedWord;
}

function isPalindrome(word) {
// Write your algorithm here
// reverse the input string
const reversedWord = reverseString(word);
// if the reversed string is the same as the input
if (word === reversedWord) {
return true;
} else {
return false;
}
}

/*
Add your pseudocode here
function isPalindrome(word) {
// reverse the input string
// if the reversed string is the same as the input
// return true
// else
// return false
}
*/

/*
Expand Down
1 change: 1 addition & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit cef03ba

Please sign in to comment.