Last active
August 28, 2019 22:31
-
-
Save Karla-Isabel-Sandoval/d6ab098c1eab2781899eea9436818467 to your computer and use it in GitHub Desktop.
Merging both methods
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//creates a loop that reverses the string | |
function palindromeUponReversal(str){ | |
let reversePotentialPalindrome = ""; | |
let regularPalindromeChecker = ""; | |
for(let char of str){ | |
reversePotentialPalindrome = char + reversePotentialPalindrome; | |
regularPalindromeChecker = regularPalindromeChecker + char; | |
} | |
if (reversePotentialPalindrome == regularPalindromeChecker){ | |
return "true"; | |
} else { | |
return "false"; | |
} | |
//return reversePotentialPalindrome; | |
} | |
var syntaxToCheck = palindromeUponReversal("kayak"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment