Ask your AI Ask your AI to turn this code into a guided bug-finding exercise.
Claude ChatGPT I am reading "A protocol allows at most 64 UTF-8 bytes for a display label. Which check enforces that contract?" on CodeWiki (https://codewiki.com/practice/mcq/foundations/unicode-text/choose-byte-boundary/).
Context (verbatim from the page):
"""
A protocol allows at most 64 UTF-8 bytes for a display label. Which check enforces that contract?
text.length <= 64
[...text].length <= 64
new TextEncoder().encode(text).length <= 64
[...new Intl.Segmenter("en", { granularity: "grapheme" }).segment(text)].length <= 64
"""
Introduce three subtle bugs into the example above and let me find them. Reveal each answer only after I have guessed.
Answer in English. Keep code examples in CS foundations. Where you are unsure, say so.