Skip to content

Commit

Permalink
commit tree 3cd77cd79ebafe954c776a026988e19292484785
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentLangat033 committed Jun 17, 2022
1 parent 623e6a0 commit 15db023
Showing 1 changed file with 6 additions and 17 deletions.
23 changes: 6 additions & 17 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,12 @@
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) {
// 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;
}
// compare the reversed string to the input
return word === reversedWord;
}

function reverseString(word) {
return word.split("").reverse().join("");
}

/*
Expand Down

0 comments on commit 15db023

Please sign in to comment.