Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added week 8/Israel/comments.md
Empty file.
18 changes: 18 additions & 0 deletions week 8/Israel/palindrome-checker.js
Original file line number Diff line number Diff line change
@@ -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()))
12 changes: 12 additions & 0 deletions week 8/Israel/palindrome-checker.md
Original file line number Diff line number Diff line change
@@ -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