@hirschp2/ispalindromejs
v3.141.5
Published
Simple JS function to determine if a provided string is a palindrome
Downloads
4
Readme
Created by Patrick Hirsch for Fall 2022's INF 286-004, Introduction to Web Development, course at Northern Kentucky University taught by Prof. John Musgrave.
This function takes an input (assumed to be a String) and tests if it as a palendrome, spelled the same forwards and backwards, case-insensitive. This is acheved by first running the built-in .toUpperCase() function as to ignore case and then checking equality of the String against the result of running it against a reversed copy of the string. The reversed copy is created by splitting the string into an array of charicars with .split(""), reversing the array with the built in .reverse() function, and then joining the array of charictars into a String with .join("").