My Palindrome Checker Project

Here is my Palindrome Checker project for the JavaScript Data Structures and Algorithms certification.

Full page view: https://codepen.io/marcus-smo/full/ZEggdad
Project link with code: https://codepen.io/marcus-smo/pen/ZEggdad

2 Likes

I think the most sticking out are comments explaining what code does. That’s mostly clear from the code itself.


Some improvements should be made with the variable naming, for example:

const regexResult = textInputValue.match(alphanumericRegex);

Yes, this is the result of the regex match, but what does it actually contain at that point?


Something that would be more visible with a more complex logic, is unnecessary nesting of code. For example:

if (...) {
  // single line
} else {
  // multiple
  // lines
  // of code
  if (...) {
    // (...)
  } else {
    // (...)
  }
}

Within function this can be easily turned into a more flat code:

if (...) {
  // single line
  return
}

// multiple
// lines
// of code
if (...) {
  // (...)
} else {
  // (...)
}

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.