I wrote the following function to find the longest palindrome in a string. It works fine but it won't work for words like "noon" or "redder".  I fiddled around and changed the first line in the for loop from:  var oddPal = centere...
I want to build a palindrome checker in javascript. All non-letter characters should be removed, so that a phrase like "A man, a plan, a canal. Panama" can also be a palindrome.    function reverse(str) {   return str.split("").revers...
I am trying to find out whether a string is a palindrome by recursion using javascript. But I can't figure out what I am missing in the code.  var firstCharacter = function(str) {     return str.slice(0, 1); };  var lastCharacter = function(str)...
I wanted to know where my logic is faulty. A string (str) is taken as an argument (the string could be lowercase, uppercase, with commas and periods) and set equal to var string. It is then reversed and if it equals the original string then the retur...
I have written this js code for palindrome, I know there are better and more efficient palindrome methods online but I want to know why I am unable to get my palindrome function to work properly?  CODE:     var pal = function(str) {    var len = str....
I have a string 'racecarzz' and I would like to generate all possible combinations of each character from that string that can be read the same way backward and forward (Palindrome).  Check for Palindromes is not difficult string.split('&...
This is a code I used for the coderbyte challenge "Palindrome". The challenge is to return true if str is the same foward and backward(a palindrome). I got all possible points but I know my code is a little ugly. What would be a more efficien...
My code works in console but gives the wrong result in hackerank Problem: Print count of all substrings that are palindromes from a string    function isPalindrome(str) {    var len = str.length;   var mid = Math.floor(len / 2);    for (var i = 0; i...
I'm trying to write code to determine if a string is a palindrome. I am making the string lowercase, taking out the spaces, and turning it into an array. Next, I am splitting it in half, reversing the second half, and comparing those two arrays t...

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.