Monday, 30 November 2026

Spot The Bug: Critical Functions

Welcome back, noble bug-hunters!

For this episode of Spot The Bug, we have a tale of imperfect inputs, followed by even more imperfect handling.

Have a blessed
bug-free day.

Here's the context. I had a stream of feedback input from a database, and to be blunt, it was a terrible design. All it had were text strings, and there wasn't even a classification field. There were two types of feedback - compliments and criticism. Compliments were the default, unless the string contained the substring "_ctiticism_".

Here's a sample.
[
  "_criticism_Loads really slowly.",
  "_criticism_Font too small.",
  "Great color scheme!",
  "There was a lot of thought put into this, and it shows.",
  "_criticism_The information could be better placed.",
  "_criticism_The navigation is confusing.",
  "I really like the overall layout.",
  "_criticism_The buttons don't look clickable enough.",
  "This is surprisingly easy to use.",
  "_criticism_There is too much information on the screen at once.",
  "_criticism_The search function could be improved.",
  "The interface feels clean and modern.",
  "_criticism_It takes too many clicks to get where I want to go.",
  "_criticism_The headings don't stand out enough.",
  "Everything seems to work exactly as expected.",
  "_criticism_The mobile layout needs some work.",
  "I like how the important information is easy to find.",
  "_criticism_Some of the wording is unnecessarily complicated.",
  "_criticism_The page feels a little cluttered.",
  "The attention to detail is impressive.",
  "_criticism_It isn't immediately obvious what I'm supposed to do next.",
  "_criticism_The contrast between some elements is too low.",
  "The overall experience is very intuitive.",
  "_criticism_The help text isn't particularly helpful."
];


I know, I know, this was shit. But I made do with what I was given. If I had my way, this would at least be a properly-formatted JSON string. Oh well. The point of this was to have a page which would receive the array, and render compliments and criticisms differently.

Here was the CSS....
<style>
body
{
  font-size: 16px;
  font-family: georgia;
}

.feedback
{
  width: 80%;
  padding: 1em;
  border-radius: 20px;
  margin-bottom: 1em;
}

.compliment
{
  border: 5px solid rgb(200, 200, 255);
}

.criticism
{
  border: 5px solid rgb(255, 200, 200);
}

.feedback.compliment::before
{
  content: "\2713";
  color: rgb(200, 200, 255);
  margin-right: 1em;
}

.feedback.criticism::before
{
  content: "\2717";
  color: rgb(255, 200, 200);
  margin-right: 1em;
}
</style>


...and this was the JavaScript. Nothing fancy.
<script>
function isNotCompliment(text)
{
  if (text.indexOf("_criticism_") != -1) return true;
  return false;
}

function addFeedback(feedback)
{
  for (var i = 0; i < feedback.length; i++)
  {
    var div = document.createElement("div");
    div.className = "feedback " + (isNotCompliment(feedback[i]) ? "criticism" : "compliment");
    div.innerHTML = feedback[i].replaceAll("_criticism_", "");
    document.body.appendChild(div);
  }
}
</script>


Looks OK so far.


Later on, though, I decided to refactor. Because isNotCompliment() was simply a stupid name. Making functions based on a negative clause just adds unnecessary complexity to things.
<script>
function isCompliment(text)
{
  if (text.indexOf("_criticism_") >= -1) return true;
  return false;
}

function addFeedback(feedback)
{
  for (var i = 0; i < feedback.length; i++)
  {
    var div = document.createElement("div");
    div.className = "feedback " + (isCompliment(feedback[i]) ? "compliment" : "criticism");
    div.innerHTML = feedback[i].replaceAll("_criticism_", "");
    document.body.appendChild(div);
  }
}
</script>


What Went Wrong

Everything registered as a compliment now! Which was really affirming, but wrong.


Why It Went Wrong

For some fucked-up reason, I was trying to say, text is a compliment if "_criticism_" is not found. Whereas before, I was trying to say text is not a compliment if "_criticism_" is found.
function isCompliment(text)
{
  if (text.indexOf("_criticism_") >= -1) return true;
  return false;
}


But instead, I ended up saying, text is a compliment whether or not "_criticism_" is found. Which was pretty dumb.

How I Fixed It

Replaced the ">" operator in the If block with another "=". Problem solved.
function isCompliment(text)
{
  if (text.indexOf("_criticism_") == -1) return true;
  return false;
}


A simple fix to a problem that should never have been. That was one helluva brain fart.

Moral of the Story

First lesson - avoid negative clauses if a positive clause can be used. This simplifies things. Second, well, don't be a moron and avoid being too permissive in your If blocks.

My _compliments_,
T___T

Tuesday, 24 November 2026

Jensen Huang's Wang Is Da Latest Thang, Yo

The Internet has been awash with, ironically, AI-generated video clip memes of Jensen Huang and his recent sex scandal. It's getting a little annoying. Jensen Huang has since resigned as CEO of Nvidia. (As of just now, it appears that he's been reinstated in what must be the fastest reverse revolving door in the history of sex scandals).

Let me begin by saying that this did not hit with any astonishment whatsoever. I know men who have a hundredth of Huang's money and power, and still can't keep it in their pants. If there's a man with both the motivation and the means (and let's be real, Huang's means are astronomical) the question shouldn't really be about whether or not that man has strayed, but how many times he's done it. At this point, there have been reports about another possible scandal with an Nvidia executive named Kimberly Powell, and possibly others.

Ouch.

What's more interesting is the news that Nvidia's stock fell when this news was disclosed. I mean, why? Rich (or poor) men failing to exercise dick discipline isn't exactly a novel concept, if you know what I mean. Why would this affect stock price? It's not like Nvidia's chip-making abilities are hotwired to Huang's testicles.

The Who

Now the real reason for the stock price plummeting, might be down to the who rather than the what. As in, who Huang was getting cosy with. A certain Alice Huang who was a decision-maker at Megaspeed, a Singapore-based corporation.

That's really why the story interests me; because this ties in to Singapore. As a Singaporean, I naturally consider our position first.

It's been alleged that Megaspeed was diverting chips that Nvidia sold them, to China. Megaspeed has, to absolutely nobody's surprise, denied this. So has Nvidia.

In principle, I don't think it's right that the USA wants to prevent a certain class of Nvidia chips from going to China. However, it's undeniably their right to do so, and Singapore being seen as party to the facilitation of subverting that right, is concerning. Singapore's reputation as a business hub is at stake. Singapore thrives because of her predictability, reliability and respect for the legal rights of all parties. Without that, what are we, really?

Honey trap!

USA's concern that Alice Huang was some kind of made-in-China honeypot is undeniably interesting... but it's yet to be proven. It should probably go without saying, but allegations made, even by the US Government, should not be automatically taken as fact.

People say that Huang should have known better. A guy in his position would be bound to attract attention like this. And it's not like he's some hunk, though some women will say he looks pretty good in that sleek leather jacket. That's not the point, either. He could be ugly as sin, and his ridiculous wealth would still make him pretty attractive to an ungodly number of people even if they're not China spies.

The irony is that while Huang is probably smarter than the average guy, he's still just a guy in a position of considerable power. He's a human being with psychological and physiological needs, the means to meet those needs, and perhaps the sense of entitlement that seems to come naturally to those in his position. And that makes him more vulnerable, not less. Because there will be more attempts in his direction, and one is bound to get through at some point. Kind of like how Microsoft's website has more security features than mine, but the number of hackers attacking them is perhaps a thousand times greater.

My friends have noted that I have a China wife, and jokingly questioned if she's a spy. Mrs TeochewThunder's response has been to point out that I have absolutely nothing of interest to a spy. Ouch. Brutal. But true.

Another who

Kimberly Powell was mentioned earlier. This one is yet to be confirmed, but if true, could also go a long way to explaining the stock price. Powell was a direct report to Huang.

This isn't exactly an original concept either; bosses have been banging secretaries even before peanut butter was a thing. But once an affair like that becomes public, it usually results in a resignation. After all, that's an obvious conflict of interest. It undermines professional trust in an organization, nevermind moral implications. Uncomfortable questions arise from this kind of thing. Even if it was consensual, how much professional pressure was the woman under? Did she receive any undue rewards from the affair? Was her influence increased as a result? These are reasonable concerns.

Private business.

Some will also say that Huang's sex life is his own private business. I agree completely that nobody needs to ever contemplate him in the act of copulation. The very thought is actually kind of off-putting, to be honest, and I'm gonna have to sandblast my brain just to get rid of that image. Probably why I'm making so many sex jokes; it's my coping mechanism.

The fact, however, is that this is a situation that goes far beyond Huang and whatever Viagra he's using. And Nvidia's falling share prices are increasingly suggestive of that by the day.

Consequences and a conclusion

I've also heard fanboys clamouring that this is a witch hunt and that Huang is indispensable to AI. They couldn't have chosen anything worse than a frail flesh and blood human being as the indispensable thing to the industry, just saying. Huang's no spring chicken. He could plausibly drop dead tomorrow. What then?

Huang being targeted?

Brilliant he may well be, but the fact is that he was having an affair and got caught. As far as I'm concerned, Huang's a big boy in a big boy world dealing with big boy repercussions. Losing his job was always par for the course. Tough titty, cry me a river. What do they expect, a medal? Grow up.

People like to say that there are no consequences for rich people. Or that consequences are different for rich people. I beg to differ. They're largely the same consequences. They just hit differently.

There's speculation, for example, about the amount of money Huang could lose from this entire debacle. To the average guy, this is a life changing number. To Huang, he could go take a piss, and he'd have recovered a quarter of that by the time he's done.

Even if not, it's just a matter of a few boats and private jets. I could be alone in my assessment, but I highly doubt any of that is needed to live a comfortable life, especially when you're in your sixties. On the other hand, Huang's wealth isn't so much a fixed number, but tied to Nvidia's stock prices. So... oh well.

Huang in there, Jensen!
T___T

Wednesday, 18 November 2026

The PHP security vulnerabilities that put the internet on notice

As of October this year, a couple of newly discovered PHP vulnerabilities threatened to rattle the Internet. The PHP2Shell vulnerability was found to have existed for the past decade, undisclosed until recently. Any PHP that's 5.4 and above is vulnerable.

For this particular vulnerability, the problem is not with insecure code. It's with PHP itself. In layperson-speak: We've been installing perfectly respectable locks on the doors, only to discover that the hinges were compromised.

Good lock, bad hinges.

Despite its flaws, PHP still runs more than seventy percent of the world's websites. That's just websites we're talking about - not interfaces such as system panels and software applications.

The bug was recently found with the help of AI, but there have been reports that even before the reported discovery, there have been signs that this vulnerability was already being probed. Which is... not a comforting thought. This bug had not been officially disclosed for the past ten years. Does that mean that seventy percent of the internet has been vulnerable for the past ten years? Damn.

My own PHP use

I have fond memories of PHP. It's what I cut my teeth on after ASP, and what sparked my career revival in the 2010s. Still, I've never been blind to its faults. I've just been extremely tolerant. Kind of like Mrs TeochewThunder - I have a soft spot for her, but boy does she annoy me sometimes.

I haven't used PHP at work in a while. These days it's JavaScript, and sometimes Python.

My personal site still runs on PHP. Recently I jacked it up from 5.6 straight to 8.5.12. Daring of me, until you consider that most of my code was future-proofed to begin with (PDO instead of MySQLi, careful array declarations, etc) and had no fancy features that would require concern on my part.

And just as I upgraded, this happened. 8.5.12 just happens to be one of the releases of PHP that have been patched. Why aren't I this lucky with the lottery?

Patched!

My hosting provider is taking care of the security patches. Hey, I'm paying for the privilege. What, you think this blog is free? I'm a cheap bastard, but not that cheap. The alternative is to get my site off my provider and host it myself and provide my own patches... did I mention I'm lazy in addition to cheap?

Conclusion

I wouldn't read too much into this development. For NodeJS, there's the Node2Shell vulnerability. In 2021, there was Java's Log4Shell. This just happened to be PHP's turn. 

EDITOR'S NOTE: These issues aren't equivalent. I picked them because of the similar "shell" naming convention.

PHP haters will crow that this is just another reason to avoid PHP, but if we're being honest, PHP is hardly unique in this regard. 


Shell-om, my friends!
T___T

Saturday, 14 November 2026

Enough of trying to be enough!

Language can be contradictory. I had the occasion to encounter one such contradiction when an ex-classmate tried to sell me insurance. He said "No matter how much insurance you buy, it's never enough." He probably meant it sincerely, but it struck me as a profoundly ineffective sales pitch - if it'll never be enough, that makes me less eager to buy insurance, not more. After all, if I'll never achieve a goal, why put pressure on myself to achieve it?

Enough, already.

That brings me to a point that several life coaches I've heard on YouTube and the Clubhouse app, like to say - "you are enough". Which, ironically, while meaning the complete opposite of "you'll never be enough", achieves the same result. If you are enough, why do more?

Being enough

Back in the day, I never told myself I was enough. That would have been a big fat lie. I knew I wasn't enough. I constantly strived to learn more, hone my craft, do better, as a web developer. But at the same time, with the way tech was advancing, it was clear as day that I would never be enough. Therein lies the contradiction; why then, did I keep going?

Late into the night.

Another friend asked, "to what end?" Why did I keep signing up for Specialist Diplomas, or spend countless nights on code? My friend felt that I needed to have an end goal in mind. In effect, he was asking, "when will it be enough?"

The answer was "never". It will never be enough, because I will never be enough. And if I'm being honest, it's part of the fun.

Because being enough wasn't a goal I was trying to achieve by working on my skills. I wasn't putting up with an unpleasant task (like buying insurance, and I apologize in advance to the psychos who actually enjoy buying insurance) to reach a destination. I genuinely enjoyed working on my skills. Not having an end in sight did not bother me. In fact, since there was no end in sight, I could just enjoy the journey instead of fussing about the destination.... because there was no destination.

Basically, I was saying to that bright-eyed bushy-tailed kid in the mirror, "you are not enough, and you don't need to be."

Career skills

To illustrate, I have never learned Kubernetes even though doing so would make me an undeniably more complete developer. Kubernetes sounds oppressively boring. It sounds like the kind of thing people pick up out of professional obligation (and yes, I apologize in advance to the psychos who actually enjoy dealing with Kubernetes). The tech field is wide and varied enough that I could easily find something way more fun to get good at.

For example, I'm sure my employer would rather I get cybersecurity certification rather than a front-end one... but it's my time I'm using, my money I'm spending, my sweat that gets expended, thus ultimately this is about my happiness, not his. In fact, I would unsympathetically say that if any employer wants a developer with a cybersecurity cert, they should hire a developer with a cybersecurity cert. Instead of hiring a developer with a whole host of certs other than a cybersecurity one, and then gambling that this dev feels an inclination to get a cybersecurity cert. I understand cost savings, but it seems like a stupid hiring practice.

Transform, dammit!

It's like purchasing a Freightliner truck and then pitching a hissy fit because it doesn't transform into Optimus Prime, or even make an effort to.

Few employers will ever think you bring enough value for what you're paid, or admit that out loud even if they do. But that's for another time, another day.

Conclusion

I'm not saying this from a position of privilege. I don't earn six figures a year unless you count CPF (who does, really?), I earn enough to get by. Though I will concede that a guy whose main love is slinging code in the wee hours of the morning needs far less than someone who's consistently hitting the nightspots. No judgement there; you contribute more to Singapore's economy than I do, thank you for your service.

This isn't career advice. You don't always have to love your job. It's not humanly possible to always love your job. But I do love what I do, and it helps when my job, my colleagues, my employers, or some unholy combination of all of them at the same time, annoy me. It certainly makes the task of striving to be better, a lot less onerous than it could otherwise be.


Enough said,
T___T

Sunday, 8 November 2026

Web Tutorial: The Palindrome Detector

One of the fun little exercises that used to get thrown at us aspiring programmers, was a palindrome checker. In the console, we'd ask the user for a string, and then see if the string was a palindrome. Trite? Completely. But it brings me back. So screw it, we're doing that today.

What's a palindrome? Well, that's a string of text that's spelled the same backwards and forwards.

"Wow."
"Madam, I'm Adam."
"Able was I ere I saw Elba."

The rules are simple - all punctuations and spaces get removed for the purposes of evaluating the text. Anything below three valid characters doesn't count. Optionally, comparison may be case-insensitive.

I don't intend to stick to best practices for this. So my CSS naming choices might be dodgy and I'm not going to insist on good semantic HTML.

Let's get to it!
Here's some starting HTML. Have divs outlined in red.
<!DOCTYPE html>
<html>
  <head>
    <title>Palindrome Checker</title>

    <style>
      body
      {
        font-size: 16px;
        font-family: Verdana;
      }

      div { outline: 1px solid red; }
    </style>

    <script>

    </script>
  </head>

  <body>

  </body>
</html>


Add three divs.
<body>
    <div id="pnlString">

    </div>

    <div id="pnlOptions">

    </div>

    <div id="pnlOutput">

    </div>

</body>


This is the CSS. All of these divs are 800 pixels in width, centered via the margin property with a bit of spacing at the top. The text is also aligned center. For pnlOutput, we even have a grey dotted border.
<style>
body
{
    font-size: 16px;
    font-family: Verdana;
}

div { outline: 1px solid red; }

#pnlString
{
    width: 800px;
    margin: 50px auto 0 auto;
    text-align: center;
}

#pnlOutput
{
    width: 800px;
    height: auto;
    margin: 10px auto 0 auto;
    text-align: center;
    border: 3px dotted rgb(100, 100, 100);
    border-radius: 30px;
}

#pnlOptions
{
    width: 800px;
    margin: 0 auto 0 auto;
    text-align: center;
}

</style>


In pnlString, we want a label and checkbox. Have some examples of a palindrome in the placeholder attribute.
<div id="pnlString">
    <input id="txtString" placeholder="Enter text, e.g, Kayak" />
</div>


More CSS. We want txtString to look a certain way. Or rather, I do. It's all visual; let your taste define the look.
#pnlString
{
    width: 800px;
    margin: 50px auto 0 auto;
    text-align: center;
}

#txtString
{
    display: inline-block;
    width: 20em;
    height: 1.5em;
    font-size: 2em;
    font-face: "Courier New", monospace;
    text-align: center;
    border-radius: 10px;
    border: 4px solid rgb(200, 200, 200);
}


#pnlOutput
{
    width: 800px;
    height: auto;
    margin: 10px auto 0 auto;
    text-align: center;
    border: 3px dotted rgb(100, 100, 100);
    border-radius: 30px;
}


So far, this is what we have.


Add two divs in pnlOutput, ids pnlResult and pnlVerification. Have some default text in them.
<div id="pnlOutput">
  <div id="pnlResult">(no text yet)</div>
  <div id="pnlVerification">Enter some text above</div>   
   
</div>


Some CSS for these divs. They both take up full width of their parent, have a defined height and have text aligned center. I'll keep the text color for pnlResult a deep grey.
#pnlOutput
{
  width: 800px;
  height: auto;
  margin: 10px auto 0 auto;
  text-align: center;
  border: 3px dotted rgb(100, 100, 100);
  border-radius: 30px;
}

#pnlResult
{
  width: 100%;
  height: 1.5em;
  font-size: 2.5em;
  font-face: Georgia;
  text-align: center;
  color: rgb(100, 100, 100);
}

#pnlVerification
{
  width: 100%;
  height: 1.5em;
  text-align: center;
}


#pnlOptions
{
  width: 800px;
  margin: 0 auto 0 auto;
  text-align: center;
}


Thus, we have display text for statuses.


Add a checkbox and label. The checkbox should have an id.
<div id="pnlOptions">
  <label><input type="checkbox" id="cbIgnoreCase">Ignore Case</label>  
</div>


Here is CSS for the label. It's basically bolded text.
  #pnlOptions
  {
    width: 800px;
    margin: 0 auto 0 auto;
    text-align: center;
  }

  label
  {
    font-weight: bold;
  }

</style>


And this is the beginning state.


Run checkPalindrome() when text changes. And when the checkbox is clicked.
<div id="pnlString">
  <input id="txtString" oninput="checkPalindrome();" placeholder="Enter text, e.g, Kayak" />
</div>

<div id="pnlOptions">
  <label><input type="checkbox" id="cbIgnoreCase" onclick="checkPalindrome();">Ignore Case</label>  
</div>


As we create checkPalindrome(), let's create two more functions - setResult() and setVerification(). They are used to populate the divs with information. Also create isPalindrome(). All these functions will be called by checkPalindrome().
<script>
  function checkPalindrome()
  {

  }

  function isPalindrome()
  {

  }

  function setResult()
  {

  }

  function setVerification()
  {

  }

</script>


setResult() is probably the easiest. We give it a parameter, str. pnlResult's content will be set with str.
function setResult(str)
{
  document.getElementById("pnlResult").innerHTML = str;

  return;

}


setVerification() has two parameters; str - just like in setResult() and colorCode, which has a default value. We begin with a return statement at the end.
function setVerification(str, colorCode = "default")
{
  return;
}


Then we have an object, colors. It has four properties, each one with a corresponding color string as a value.
function setVerification(str, colorCode = "default")
{
  let colors =
  {
    "default": "black",
    "success": "green",
    "failure": "red",
    "pending": "grey"
  };


  return;
}


We set pnlVerification as the DOM element pnlVerification. Then we set its color property by referencing the colors object with the value of colorCode, and set the content using str.
function setVerification(str, colorCode = "default")
{
  let colors =
  {
    "default": "black",
    "success": "green",
    "failure": "red",
    "pending": "grey"
  };

  let pnlVerification = document.getElementById("pnlVerification");
  pnlVerification.style.color = colors[colorCode];
  pnlVerification.innerHTML = str;


  return;
}


isPalindrome() has a parameter, str. Its job is to determine if str is a palindrome. For this, we declare arr as an array of all letters of str. We use the Spread operator for this.
function isPalindrome(str)
{
  let arr = [...str];
}


We return a Boolean value, determined by reversing arr and turning it back into a string using the join() method (with an empty string as the argument) and then comparing the result to str.
function isPalindrome(str)
{
  let arr = [...str];
  return (arr.reverse().join("") == str);
}


Now we're finally going to work on checkPalindrome(). We start by declaring txtString as the DOM element by the same id. We then declare processed, and use it to store the value of the sanitized value of txtString, by stripping out anything that isn't an alphabetical character.
function checkPalindrome()
{
  let txtString = document.getElementById("txtString");
  let processed = txtString.value.replace(/[^a-zA-Z]/g, "");


  return;
}


And if processed turns out to have zero usable characters, reset to factory settings.
function checkPalindrome()
{
  let txtString = document.getElementById("txtString");
  let processed = txtString.value.replace(/[^a-zA-Z]/g, "");

  if (processed.length == 0)
  {
    setResult("(no text yet)");
    setVerification("Enter some text above", "default");
  }


  return;
}


Now that's out of the way, we should, regardless, make processed visible by using it as an argument in setResult(). Then we'll have an If-else block to check if processed has 1 character or less. In that case, we'll set the text to "Inconclusive..." with a different color code. If later processed turns out to have zero characters, it will be handled by the If block at the bottom.
function checkPalindrome()
{
  let txtString = document.getElementById("txtString");
  let processed = txtString.value.replace(/[^a-zA-Z]/g, "");

  setResult(processed);

  if (processed.length <= 1)
  {
    setVerification("Inconclusive...", "pending");
  }
  else
  {

  }


  if (processed.length == 0)
  {
    setResult("(no text yet)");
    setVerification("Enter some text above", "default");
  }

  return;
}


If there's 2 or more characters, we check if processed is a palindrome using the isPalindome() function, then use setVerification() accordingly.
function checkPalindrome()
{
  let txtString = document.getElementById("txtString");
  let processed = txtString.value.replace(/[^a-zA-Z]/g, "");

  setResult(processed);

  if (processed.length <= 1)
  {
    setVerification("Inconclusive...", "pending");
  }
  else
  {
    if (isPalindrome(processed))
    {
      setVerification("This is a Palindrome!", "success");
    }
    else
    {
      setVerification("This is not a Palindrome!", "failure");
    }

  }

  if (processed.length == 0)
  {
    setResult("(no text yet)");
    setVerification("Enter some text above", "default");
  }

  return;
}


But what about the checkbox?

Well, glad you asked. Declare cbIgnoreCase as the checkbox.
function checkPalindrome()
{
  let txtString = document.getElementById("txtString");
  let processed = txtString.value.replace(/[^a-zA-Z]/g, "");
  let cbIgnoreCase = document.getElementById("cbIgnoreCase");

  setResult(processed);

  if (processed.length <= 1)
  {
    setVerification("Inconclusive...", "pending");
  }
  else
  {
    if (isPalindrome(processed))
    {
      setVerification("This is a Palindrome!", "success");
    }
    else
    {
      setVerification("This is not a Palindrome!", "failure");
    }
  }

  if (processed.length == 0)
  {
    setResult("(no text yet)");
    setVerification("Enter some text above", "default");
  }

  return;
}


Now we see if cbIgnoreCase is checked. If so, we set processed to be all in lowercase. Which means that when it's eventually run through isPalindrome(), it will be treated as though it's in all lowercase regardless of what case txtString is in.
function checkPalindrome()
{
  let txtString = document.getElementById("txtString");
  let processed = txtString.value.replace(/[^a-zA-Z]/g, "");
  let cbIgnoreCase = document.getElementById("cbIgnoreCase");

  if (cbIgnoreCase.checked) processed = processed.toLowerCase();
  setResult(processed);

  if (processed.length <= 1)
  {
    setVerification("Inconclusive...", "pending");
  }
  else
  {
    if (isPalindrome(processed))
    {
      setVerification("This is a Palindrome!", "success");
    }
    else
    {
      setVerification("This is not a Palindrome!", "failure");
    }
  }

  if (processed.length == 0)
  {
    setResult("(no text yet)");
    setVerification("Enter some text above", "default");
  }

  return;
}


Time to test!

Remove the red outlines.
div { outline: 0px solid red; }


We'll use "kayak". Start by adding a "k". It should read as "inconclusive", because there's only 1 character.


Add "a". Now the interface is sure; this is not a palindrome.


Add "12345". The script screens all these out, so the string to be compared is still "ka".


Now add "yaK". Note the capitalization. So the resultant string is "kayaK".


If you click on the checkbox, now the resultant string is "kayak". It's a palindrome!

Are you Wow-ed yet?

This wasn't flashy, but boy did I feel like a young programmer again! Simple enough to hand-code, small enough to digest!


xoxox,
T___T