← All posts

August 5, 2025 · Nathaniel Hoyt

Claude & 3 Simple QA Tests (in-browser)

  • #development
  • #ai
  • #ai-august
Claude & 3 Simple QA Tests (in-browser)

I've met plenty of people who were skeptical about Ai. I was skeptical too. However, it was time to get with the program. Inspired by Evan Borden and Alex Pierce, I decided to dedicate August 2025 to using Ai tools.

Perhaps I have watched too many sci-fi movies or I am just old enough to question AI, but I started by just dipping my toes in.

Can it understand and fix code? (preferably without a Cylon virus shutting down my network)

Test 1:

I pasted a line of code that was throwing an error into Claude and prompted:

Why does this line throw an error?

My request was quite vague and didn't give any context, but Claude gave me a possible explanation and three options that may resolve that error. Very noncommittal, but the response also very fitting considering the ask.

Test 2:

I saw a conversation about two listeners and pasted a code vs code comparison into Claude I was not disappointed:

$(document).on('click', 'a, button', function (e) {  // vs
$('a, button').on('click', function(e) {

Claude explained what the differences were. Claude also followed up by giving a modern example. Nice touch, Claude!

$(document).on('click', 'a, button', function (e) {

Event Delegation

  • Attaches ONE event listener to the document
  • Listens for clicks that bubble up from any a or button elements
  • Works for elements that exist now AND elements added later dynamically
  • More memory efficient for many elements
$('a, button').on('click', function(e) {

Direct Event Binding

  • Attaches individual event listeners directly to each a and button element that exists right now
  • Only works for elements that exist at the time this code runs
  • Won't work for elements added to the page later via JavaScript

Test 3:

I had a task to sanitize some inputs so I pasted one of the lines of code to see what Claude came up with:

Can you sanitize this:

getInput: function (input) { return (typeof input === 'object') ? input : $(input); }

Claude returned a much more comprehensive update than I imagined. Claude also included a note to check on the original object check. 🙂

getInput: function (input) {
  // Validate input parameter
  if (input == null) { return null; }
  // If it's already a jQuery object, return it
  if (input instanceof jQuery) { return input; }
  // If it's a DOM element, wrap it with jQuery
  if (input instanceof Element) { return $(input); }
  // If it's a string, treat it as a selector but validate it first
  if (typeof input === 'string') {
    // Basic validation to prevent malicious selectors
    if (input.trim() === '' || input.length > 1000) {
      throw new Error('Invalid selector');
    }
    // Uncomment and use DOMPurify if available for HTML content
    // const sanitizedInput = DOMPurify.sanitize(input);
    // return $(sanitizedInput);
    return $(input);
  }
  // For other object types, return as-is (but consider if this is safe)
  if (typeof input === 'object') { return input; }
  // Fallback for unexpected input types
  throw new Error('Unsupported input type');
},

I was quite impressed with just the few examples of using Claude with coding challenges. And this was just in-browser. Claude quickly showed an understanding of code and presented updated code, explanations, summaries, and options.

Let’s Talk

We all have a story to tell. Whether it’s a website, a logo, or a design, let’s help you tell that story.

Let’s Talk

Tell us about your project and we’ll get back to you.

Protected by reCAPTCHA.

Connect with us