Skip to content

This application asks a user for a phrase or a word. It checks the user input, runs palindrome check on it, and tells user whether the entered string is a palindrome or not.

Notifications You must be signed in to change notification settings

MohiCodings/Palindrome_Checker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Palindrome_Checker

Palindrome Checker

-A palindrome is a word, number, phrase, or other sequence of characters which reads the same backward as forward ignoring punctuation, case, and spacing.

-A palindrome is a word or sentence that's spelled the same way both forward and backward, ignoring punctuation, case, and spacing (e.g. mom, dad, racecar, madam). A palindrome checker checks if a string is a palindrome or not.

This application asks a user for a phrase or a word. It checks the user input, runs palindrome check on it, and tells user whether the entered string is a palindrome or not.

Demo

https://mohicodings.github.io/Palindrome_Checker/

Getting Started 🖥️

To use Palindrome Checker , follow these steps:

Download or copy the code from this repository.

Open the index.html file in a web browser.

Features

  • Takes input string and checks wheather it is palindrome ore not.
  • Displays the result.

Technologies Used

  • JavaScript
  • HTML
  • CSS

Some of the famous palindromes 🌟

  • A Man, A Plan, A Canal-Panama!
  • Madam In Eden, I’m Adam
  • Dammit, I’m Mad!
  • Was It A Rat I Saw?
  • A Santa Lived As a Devil At NASA

Acknowledgments

This project was developed as an Certification task for FreeCodeCamp- Javascript and Data Structure Certification.

About Freecodecamp Certification

FreeCodeCamp Palindrome Checker - JavaScript Algorithms and Data Structures Projects (https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/palindrome-checker)

-Return true if the given string is a palindrome. Otherwise, return false. A palindrome is a word or sentence that's spelled the same way both forward and backward, ignoring punctuation, case, and spacing.

-Note You'll need to remove all non-alphanumeric characters (punctuation, spaces and symbols) and turn everything into the same case (lower or upper case) in order to check for palindromes.

-We'll pass strings with varying formats, such as "racecar", "RaceCar", and "race CAR" among others.

-We'll also pass strings with special symbols, such as "2A33a2", "2A3 3a2", and "2_A33#A2".

Test cases

palindrome("eye") should return a boolean.

palindrome("eye") should return true.

palindrome("_eye") should return true.

palindrome("race car") should return true.

palindrome("not a palindrome") should return false.

palindrome("A man, a plan, a canal. Panama") should return true.

palindrome("never odd or even") should return true.

palindrome("nope") should return false.

palindrome("almostomla") should return false.

palindrome("My age is 0, 0 si ega ym.") should return true.

palindrome("1 eye for of 1 eye.") should return false.

palindrome("0_0 (: /-\ :) 0-0") should return true.

palindrome("five|_/|four") should return false

Solution

function palindrome(str) { const alphanumericOnly = str // 1) Lowercase the input .toLowerCase() // 2) Strip out non-alphanumeric characters .match(/[a-z0-9]/g);

    // 3) return string === reversedString
    return alphanumericOnly.join('') ===
        alphanumericOnly.reverse().join('');}

palindrome("eye");   

palindrome("eye");

About

This application asks a user for a phrase or a word. It checks the user input, runs palindrome check on it, and tells user whether the entered string is a palindrome or not.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published