completed homework re functions and scope - dbogaerts #5

Open
wants to merge 12 commits into
base: master
from

Conversation

Projects
None yet
2 participants
@bogey1185

bogey1185 commented Dec 14, 2018

No description provided.

}
}
return true;
}

This comment has been minimized.

@reuben

reuben Jan 7, 2019

Contributor

you only need to check up to square root of num because of math

let finalArray = newArray.join('');
return finalArray;
}
console.log(insertDash(454793));

This comment has been minimized.

@reuben

reuben Jan 7, 2019

Contributor

great job

// Make your palindrome function work even if the string contains punctuation. So: "Sit on a potato pan, Otis!!!" or "A man, a plan, a canal: Panama." or "Cigar? Toss it in a can! It is so tragic." would pass the test.

const checkPalindrome3 = (str) => {
let sanitizedStr = str.split('.').join('').split('"').join('').split('!').join('').split(',').join('').split(':').join('').split(';').join('').split('?').join('').split(' ').join('').toLowerCase();

This comment has been minimized.

@reuben

reuben Jan 7, 2019

Contributor

haha clever approach, if a bit brute-force-ish

} else {
return false;
}
}

This comment has been minimized.

@reuben

reuben Jan 7, 2019

Contributor

see if you can do it using Regular expressions, that way you won't need something like line 177, although I got a kick out of reading that line

}
}

console.log(checkWordPalindrome("Son, I am able,\" she said. \"Though you scare me, watch!\" said I, \"Beloved,\" I said, \"watch me scare you!\" Though, said she: \"able am I, son."));

This comment has been minimized.

@reuben

reuben Jan 7, 2019

Contributor

escaping is cheating 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment