diff --git a/week 8/Israel/comments.md b/week 8/Israel/comments.md new file mode 100644 index 0000000..e69de29 diff --git a/week 8/Israel/palindrome-checker.js b/week 8/Israel/palindrome-checker.js new file mode 100644 index 0000000..023302d --- /dev/null +++ b/week 8/Israel/palindrome-checker.js @@ -0,0 +1,18 @@ +function Palindrome (str) { + var stringReplaced = str.replace(/\s/g, '') + var checkPalindrome = str + .split('') + .reverse() + .join('') + .replace(/\s/g, '') + + if (checkPalindrome === stringReplaced) { + return true + } else { + // code goes here + return false + } +} + +// keep this function call here +console.log(Palindrome(readline())) diff --git a/week 8/Israel/palindrome-checker.md b/week 8/Israel/palindrome-checker.md new file mode 100644 index 0000000..39537dc --- /dev/null +++ b/week 8/Israel/palindrome-checker.md @@ -0,0 +1,12 @@ +--- +Author: Israel +Date: 11-11-22 +--- + +Palindrome +Have the function Palindrome(str) take the str parameter being passed and return the string true if the parameter is a palindrome, (the string is the same forward as it is backward) otherwise return the string false. For example: "racecar" is also "racecar" backwards. Punctuation and numbers will not be part of the string. +Examples +Input: "never odd or even" +Output: true +Input: "eye" +Output: true \ No newline at end of file