mirror of
https://github.moeyy.xyz/https://github.com/trekhleb/javascript-algorithms.git
synced 2024-11-14 06:52:59 +08:00
Merge b9ff1b37f5
into ca3d16dcce
This commit is contained in:
commit
07525d56ec
11
src/algorithms/string/palindrome/palindrome
Normal file
11
src/algorithms/string/palindrome/palindrome
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
function checkPalindrome(str){
|
||||||
|
if(str.split('').reverse().join('') == str)
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (checkPalindrome("madam") !== true)
|
||||||
|
console.log("Test fails: Expected true for input str = 'madam'");
|
||||||
|
else
|
||||||
|
console.log("Sample test case for input str = 'madam' passed!");
|
Loading…
Reference in New Issue
Block a user