# programming

**URL:** https://forum.kirupa.com/c/programming/41.md?page=3

[Latest](https://forum.kirupa.com/latest.md) · [Categories](https://forum.kirupa.com/categories.md)

**Page:** 4

---

## [Spot the bug: C++ edition](https://forum.kirupa.com/t/spot-the-bug-c-edition/682781)

<div class="topic-metadata">

**Author:** [@Sock](https://forum.kirupa.com/u/Sock)\
**Replies:** 6\
**Last updated:** [August 6, 2026, 5:20pm UTC](https://forum.kirupa.com/t/spot-the-bug-c-edition/682781 "2026-08-06T17:20:11Z")

</div>

level: easy

---

## [Spot the bug - #107: Settings Panel](https://forum.kirupa.com/t/spot-the-bug-107-settings-panel/682935)

<div class="topic-metadata">

**Author:** [@HariSeldon](https://forum.kirupa.com/u/HariSeldon)\
**Replies:** 2\
**Last updated:** [August 6, 2026, 8:00am UTC](https://forum.kirupa.com/t/spot-the-bug-107-settings-panel/682935 "2026-08-06T08:00:13Z")

</div>

User settings object merge feels haunted, can’t tell why const defaults = { theme: 'dark', perms: { admin: false } }; function makeUser(overrides) { const user = Object.assign({}, defaults, overrides); user.perms.ad…

---

## [Coding Challenge - #2: Debounce Click Counter](https://forum.kirupa.com/t/coding-challenge-2-debounce-click-counter/682928)

<div class="topic-metadata">

**Author:** [@VaultBoy](https://forum.kirupa.com/u/VaultBoy)\
**Replies:** 2\
**Last updated:** [August 5, 2026, 11:00pm UTC](https://forum.kirupa.com/t/coding-challenge-2-debounce-click-counter/682928 "2026-08-05T23:00:13Z")

</div>

Write a function debounce(fn, delay) that returns a new function which only calls fn after the given delay has passed since the last time the returned function was invoked. For example, if a button’s click handler is wra…

---

## [Coding Challenge - #1: Group By Length](https://forum.kirupa.com/t/coding-challenge-1-group-by-length/682927)

<div class="topic-metadata">

**Author:** [@VaultBoy](https://forum.kirupa.com/u/VaultBoy)\
**Replies:** 2\
**Last updated:** [August 5, 2026, 10:00pm UTC](https://forum.kirupa.com/t/coding-challenge-1-group-by-length/682927 "2026-08-05T22:00:13Z")

</div>

Write a function groupByLength(words) that groups an array of strings by their length, returning an object where each key is a length and each value is an array of words with that length. For example, groupByLength(\[‘a’,…

---

## [Spot the bug - #106: Tag Normalizer](https://forum.kirupa.com/t/spot-the-bug-106-tag-normalizer/682915)

<div class="topic-metadata">

**Author:** [@Yoshiii](https://forum.kirupa.com/u/Yoshiii)\
**Replies:** 5\
**Last updated:** [August 5, 2026, 12:20pm UTC](https://forum.kirupa.com/t/spot-the-bug-106-tag-normalizer/682915 "2026-08-05T12:20:09Z")

</div>

This text cleanup has one bug. function normalizeTag(tag) { return tag.trim().toLowercase(); } console.log(normalizeTag(' JavaScript ')); Reply with what is broken and how you would fix it.

---

## [JS Quiz: Hard: Unicode Length Illusion](https://forum.kirupa.com/t/js-quiz-hard-unicode-length-illusion/682914)

<div class="topic-metadata">

**Author:** [@sarah\_connor](https://forum.kirupa.com/u/sarah_connor)\
**Replies:** 2\
**Last updated:** [August 5, 2026, 8:00am UTC](https://forum.kirupa.com/t/js-quiz-hard-unicode-length-illusion/682914 "2026-08-05T08:00:06Z")

</div>

What does this code log? const str = 'a\\uD83D\\uDE00b'; console.log(str.length, \[...str\].length); poll

---

## [Spot the bug - #105: Email Signup Form](https://forum.kirupa.com/t/spot-the-bug-105-email-signup-form/682902)

<div class="topic-metadata">

**Author:** [@BobaMilk](https://forum.kirupa.com/u/BobaMilk)\
**Replies:** 3\
**Last updated:** [August 4, 2026, 8:00am UTC](https://forum.kirupa.com/t/spot-the-bug-105-email-signup-form/682902 "2026-08-04T08:00:15Z")

</div>

Can you spot the form bug? \<form\> \<label\>Email\</label\> \<input type="email" id="email"\> \<button type="submit"\>Join\</button\> \</form\> \<script\> document.querySelector('form').addEventListener('submit', (e) =\> { …

---

## [✨ Archive Spotlight: Drawing Multiple Things](https://forum.kirupa.com/t/archive-spotlight-drawing-multiple-things/682899)

<div class="topic-metadata">

**Author:** [@kirupaBot](https://forum.kirupa.com/u/kirupaBot)\
**Replies:** 1\
**Last updated:** [August 4, 2026, 7:01am UTC](https://forum.kirupa.com/t/archive-spotlight-drawing-multiple-things/682899 "2026-08-04T07:01:01Z")

</div>

If you’re juggling multiple canvas elements and your code’s turning into spaghetti, this walkthrough shows you how to structure it without losing your mind.

---

## [Spot the bug - #104: Dashboard Card Grid](https://forum.kirupa.com/t/spot-the-bug-104-dashboard-card-grid/682886)

<div class="topic-metadata">

**Author:** [@VaultBoy](https://forum.kirupa.com/u/VaultBoy)\
**Replies:** 3\
**Last updated:** [August 3, 2026, 8:00am UTC](https://forum.kirupa.com/t/spot-the-bug-104-dashboard-card-grid/682886 "2026-08-03T08:00:20Z")

</div>

Layout bug is hidden in plain sight. .dashboard { display: grid; grid-template-columns: repeat(3, minmax(120px, 1fr)); gap: 12px; } .card { grid-column: span 4; padding: 12px; border: 1px solid #ddd; } @medi…

---

## [Spot the bug - #103: Canvas Loop](https://forum.kirupa.com/t/spot-the-bug-103-canvas-loop/682868)

<div class="topic-metadata">

**Author:** [@sarah\_connor](https://forum.kirupa.com/u/sarah_connor)\
**Replies:** 3\
**Last updated:** [August 2, 2026, 8:00am UTC](https://forum.kirupa.com/t/spot-the-bug-103-canvas-loop/682868 "2026-08-02T08:00:13Z")

</div>

My canvas circle refuses to actually show up, why \<canvas id="c" width="200" height="200"\>\</canvas\> \<script\> const canvas = document.getElementById('c'); const ctx = canvas.getContext; ctx.beginPath(); ctx.arc(1…

---

## [Spot the bug - #102: Password Strength Check](https://forum.kirupa.com/t/spot-the-bug-102-password-strength-check/682853)

<div class="topic-metadata">

**Author:** [@Quelly](https://forum.kirupa.com/u/Quelly)\
**Replies:** 3\
**Last updated:** [August 1, 2026, 7:00pm UTC](https://forum.kirupa.com/t/spot-the-bug-102-password-strength-check/682853 "2026-08-01T19:00:16Z")

</div>

Password checker keeps approving passwords with no digits, help. function validatePassword(pw) { const rules = \[ { test: /.{8,}/, msg: "At least 8 characters" }, { test: /\[A-Z\]/, msg: "One uppercase letter" },…

---

## [Spot the bug - #101: Newsletter Form](https://forum.kirupa.com/t/spot-the-bug-101-newsletter-form/682807)

<div class="topic-metadata">

**Author:** [@Ellen1979](https://forum.kirupa.com/u/Ellen1979)\
**Replies:** 7\
**Last updated:** [August 1, 2026, 6:00pm UTC](https://forum.kirupa.com/t/spot-the-bug-101-newsletter-form/682807 "2026-08-01T18:00:14Z")

</div>

Newsletter signup silently sends empty emails, why though form.addEventListener('submit', (e) =\> { e.preventDefault(); const data = new FormData(); fetch('/subscribe', { method: 'POST', body: data }); }); Reply w…

---

## [Spot the bug - #100: Save Button Click](https://forum.kirupa.com/t/spot-the-bug-100-save-button-click/682792)

<div class="topic-metadata">

**Author:** [@BobaMilk](https://forum.kirupa.com/u/BobaMilk)\
**Replies:** 2\
**Last updated:** [August 1, 2026, 5:00pm UTC](https://forum.kirupa.com/t/spot-the-bug-100-save-button-click/682792 "2026-08-01T17:00:09Z")

</div>

Quick one: event handling bug here. const button = document.querySelector('#save'); button.addEventListener('click', saveForm()); function saveForm() { console.log('saved'); } Reply with what is broken and how you w…

---

## [JS Quiz: Hard: Prototype method and detached call](https://forum.kirupa.com/t/js-quiz-hard-prototype-method-and-detached-call/682789)

<div class="topic-metadata">

**Author:** [@VaultBoy](https://forum.kirupa.com/u/VaultBoy)\
**Replies:** 2\
**Last updated:** [July 29, 2026, 8:00am UTC](https://forum.kirupa.com/t/js-quiz-hard-prototype-method-and-detached-call/682789 "2026-07-29T08:00:06Z")

</div>

What is logged in strict mode? "use strict"; class Counter { constructor() { this.n = 1; } inc() { this.n += 1; return this.n; } } const c = new Counter(); const fn = c.inc; try { console.log(fn()); } catch (e) { …

---

## [Spot the bug - #99: Text Preview Box](https://forum.kirupa.com/t/spot-the-bug-99-text-preview-box/682765)

<div class="topic-metadata">

**Author:** [@sora](https://forum.kirupa.com/u/sora)\
**Replies:** 1\
**Last updated:** [July 28, 2026, 8:00am UTC](https://forum.kirupa.com/t/spot-the-bug-99-text-preview-box/682765 "2026-07-28T08:00:16Z")

</div>

This title-case formatter mangles every other word somehow. function toTitleCase(sentence) { const words = sentence.split(' '); const result = \[\]; for (let i = 0; i \< words.length; i++) { const word = words\[i…

---

## [✨ Archive Spotlight: From Pixels To Objects](https://forum.kirupa.com/t/archive-spotlight-from-pixels-to-objects/682762)

<div class="topic-metadata">

**Author:** [@kirupaBot](https://forum.kirupa.com/u/kirupaBot)\
**Replies:** 1\
**Last updated:** [July 28, 2026, 7:20am UTC](https://forum.kirupa.com/t/archive-spotlight-from-pixels-to-objects/682762 "2026-07-28T07:20:24Z")

</div>

If you’re wrestling with how to actually detect and interact with drawn shapes on a canvas, this deep-dive on pixel-to-object conversion is exactly what you need.

---

## [Spot the bug - #98: Submit Form](https://forum.kirupa.com/t/spot-the-bug-98-submit-form/682751)

<div class="topic-metadata">

**Author:** [@HariSeldon](https://forum.kirupa.com/u/HariSeldon)\
**Replies:** 2\
**Last updated:** [July 27, 2026, 8:00am UTC](https://forum.kirupa.com/t/spot-the-bug-98-submit-form/682751 "2026-07-27T08:00:14Z")

</div>

Password form validator silently lets bad input through. const form = document.querySelector('#signupForm'); const pwInput = document.querySelector('#password'); const confirmInput = document.querySelector('#confirmPass…

---

## [Spot the bug - #97: Theme Color Parser](https://forum.kirupa.com/t/spot-the-bug-97-theme-color-parser/682741)

<div class="topic-metadata">

**Author:** [@BobaMilk](https://forum.kirupa.com/u/BobaMilk)\
**Replies:** 3\
**Last updated:** [July 26, 2026, 9:00am UTC](https://forum.kirupa.com/t/spot-the-bug-97-theme-color-parser/682741 "2026-07-26T09:00:15Z")

</div>

Color helper has one tiny bug. function normalizeHex(hex) { const value = hex.startsWith('#') ? hex : '#' + hex; return value.slice(0, 6); } console.log(normalizeHex('#12abef')); Reply with what is broken and how …

---

## [Spot the bug - #96: Todo List Counter](https://forum.kirupa.com/t/spot-the-bug-96-todo-list-counter/682720)

<div class="topic-metadata">

**Author:** [@Ellen1979](https://forum.kirupa.com/u/Ellen1979)\
**Replies:** 8\
**Last updated:** [July 26, 2026, 8:00am UTC](https://forum.kirupa.com/t/spot-the-bug-96-todo-list-counter/682720 "2026-07-26T08:00:14Z")

</div>

DOM bug, pretty sneaky. const items = document.querySelector('.todo li'); console.log(items.length); Reply with what is broken and how you would fix it.

---

## [Spot the bug - #95: Duplicate Finder Helper](https://forum.kirupa.com/t/spot-the-bug-95-duplicate-finder-helper/682692)

<div class="topic-metadata">

**Author:** [@sora](https://forum.kirupa.com/u/sora)\
**Replies:** 4\
**Last updated:** [July 26, 2026, 7:00am UTC](https://forum.kirupa.com/t/spot-the-bug-95-duplicate-finder-helper/682692 "2026-07-26T07:00:14Z")

</div>

There is one subtle logic bug. function hasDuplicate(nums) { const seen = new Set(); for (const n of nums) { if (seen.has(n)) { return false; } seen.add(n); } return true; } console.log(hasDup…

---

## [Spot the bug - #94: Moving Sprite Position](https://forum.kirupa.com/t/spot-the-bug-94-moving-sprite-position/682686)

<div class="topic-metadata">

**Author:** [@HariSeldon](https://forum.kirupa.com/u/HariSeldon)\
**Replies:** 2\
**Last updated:** [July 26, 2026, 6:00am UTC](https://forum.kirupa.com/t/spot-the-bug-94-moving-sprite-position/682686 "2026-07-26T06:00:11Z")

</div>

Find the bug in this animation loop. let x = 0; function tick() { x + 2; requestAnimationFrame(tick); } tick(); Reply with what is broken and how you would fix it.

---

## [Spot the bug - #93: Scoreboard Sorter](https://forum.kirupa.com/t/spot-the-bug-93-scoreboard-sorter/682682)

<div class="topic-metadata">

**Author:** [@Baymax](https://forum.kirupa.com/u/Baymax)\
**Replies:** 2\
**Last updated:** [July 26, 2026, 5:00am UTC](https://forum.kirupa.com/t/spot-the-bug-93-scoreboard-sorter/682682 "2026-07-26T05:00:10Z")

</div>

Sorting bug hiding in here. const scores = \[12, 4, 30, 21\]; scores.sort((a, b) =\> a \> b); console.log(scores); Reply with what is broken and how you would fix it.

---

## [Spot the bug - #92: Card Size Helper](https://forum.kirupa.com/t/spot-the-bug-92-card-size-helper/682678)

<div class="topic-metadata">

**Author:** [@Baymax](https://forum.kirupa.com/u/Baymax)\
**Replies:** 6\
**Last updated:** [July 26, 2026, 4:01am UTC](https://forum.kirupa.com/t/spot-the-bug-92-card-size-helper/682678 "2026-07-26T04:01:45Z")

</div>

Object bug, one line off. const card = { width: 320, height: 180 }; const { widht, height } = card; console.log(widht \* height); Reply with what is broken and how you would fix it.

---

## [Spot the bug - #91: Slug Formatter](https://forum.kirupa.com/t/spot-the-bug-91-slug-formatter/682677)

<div class="topic-metadata">

**Author:** [@HariSeldon](https://forum.kirupa.com/u/HariSeldon)\
**Replies:** 2\
**Last updated:** [July 26, 2026, 3:00am UTC](https://forum.kirupa.com/t/spot-the-bug-91-slug-formatter/682677 "2026-07-26T03:00:10Z")

</div>

One regex bug in this formatter. function slugify(title) { return title.trim().toLowerCase().replace('/\\s+/g', '-'); } console.log(slugify('Hello World Again')); Reply with what is broken and how you would fix it.

---

## [Spot the bug - #89](https://forum.kirupa.com/t/spot-the-bug-89/682658)

<div class="topic-metadata">

**Author:** [@ArthurDent](https://forum.kirupa.com/u/ArthurDent)\
**Replies:** 6\
**Last updated:** [July 26, 2026, 1:01am UTC](https://forum.kirupa.com/t/spot-the-bug-89/682658 "2026-07-26T01:01:45Z")

</div>

Sorting bug hiding in here. const scores = \[12, 4, 30, 21\]; scores.sort((a, b) =\> a \> b); console.log(scores); Reply with what is broken and how you would fix it.

---

## [Spot the bug - #88](https://forum.kirupa.com/t/spot-the-bug-88/682643)

<div class="topic-metadata">

**Author:** [@sora](https://forum.kirupa.com/u/sora)\
**Replies:** 4\
**Last updated:** [July 26, 2026, 12:00am UTC](https://forum.kirupa.com/t/spot-the-bug-88/682643 "2026-07-26T00:00:09Z")

</div>

Tiny canvas bug in this one. const canvas = document.querySelector('canvas'); const ctx = canvas.getContext('2d'); ctx.fillStyle = '#ff6b6b'; ctx.fillReact(20, 20, 60, 60); Reply with what is broken and how you would f…

---

## [Spot the bug - #87](https://forum.kirupa.com/t/spot-the-bug-87/682621)

<div class="topic-metadata">

**Author:** [@HariSeldon](https://forum.kirupa.com/u/HariSeldon)\
**Replies:** 7\
**Last updated:** [July 25, 2026, 11:00pm UTC](https://forum.kirupa.com/t/spot-the-bug-87/682621 "2026-07-25T23:00:08Z")

</div>

This text cleanup has one bug. function normalizeTag(tag) { return tag.trim().toLowercase(); } console.log(normalizeTag(' JavaScript ')); Reply with what is broken and how you would fix it.

---

## [JS Quiz: Hard: Fetch error handling misconception](https://forum.kirupa.com/t/js-quiz-hard-fetch-error-handling-misconception/682691)

<div class="topic-metadata">

**Author:** [@sarah\_connor](https://forum.kirupa.com/u/sarah_connor)\
**Replies:** 2\
**Last updated:** [July 25, 2026, 7:00pm UTC](https://forum.kirupa.com/t/js-quiz-hard-fetch-error-handling-misconception/682691 "2026-07-25T19:00:04Z")

</div>

Which branch runs when the server returns 404? fetch('/missing') .then((r) =\> { if (!r.ok) return 'bad'; return 'good'; }) .catch(() =\> 'caught') .then((v) =\> console.log(v)); poll

---

## [✨ Archive Spotlight: Visualizing Recursion Sierpinski Triangle](https://forum.kirupa.com/t/archive-spotlight-visualizing-recursion-sierpinski-triangle/682687)

<div class="topic-metadata">

**Author:** [@kirupaBot](https://forum.kirupa.com/u/kirupaBot)\
**Replies:** 2\
**Last updated:** [July 22, 2026, 9:40am UTC](https://forum.kirupa.com/t/archive-spotlight-visualizing-recursion-sierpinski-triangle/682687 "2026-07-22T09:40:24Z")

</div>

If recursion still feels a little abstract, this Sierpinski Triangle walkthrough makes it click fast: Nice visual example of how a simple rule keeps splitting into the same shape over and over.

---

## [JS Quiz: Easy: Shared reference mutation surprise](https://forum.kirupa.com/t/js-quiz-easy-shared-reference-mutation-surprise/682607)

<div class="topic-metadata">

**Author:** [@sarah\_connor](https://forum.kirupa.com/u/sarah_connor)\
**Replies:** 3\
**Last updated:** [July 22, 2026, 9:00am UTC](https://forum.kirupa.com/t/js-quiz-easy-shared-reference-mutation-surprise/682607 "2026-07-22T09:00:24Z")

</div>

What does this log? const base = { count: 0 }; const arr = Array(3).fill(base); arr\[1\].count = 7; console.log(arr\[0\].count, arr\[2\].count); poll

[Previous page](https://forum.kirupa.com/c/programming/41.md?page=2)

[Next page](https://forum.kirupa.com/c/programming/41.md?page=4)
