# programming

**URL:** https://forum.kirupa.com/c/programming/41.md

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

---

## [About the programming category](https://forum.kirupa.com/t/about-the-programming-category/42)

<div class="topic-metadata">

**Author:** [@krilnon](https://forum.kirupa.com/u/krilnon)\
**Replies:** 0\
**Last updated:** [October 10, 2014, 9:09am UTC](https://forum.kirupa.com/t/about-the-programming-category/42 "2014-10-10T09:09:38Z")

</div>

---

## [Choosing between AI app builders for a small side project — how do you decide?](https://forum.kirupa.com/t/choosing-between-ai-app-builders-for-a-small-side-project-how-do-you-decide/683978)

<div class="topic-metadata">

**Author:** [@farahednafionah1375](https://forum.kirupa.com/u/farahednafionah1375)\
**Replies:** 2\
**Last updated:** [November 10, 2026, 3:21pm UTC](https://forum.kirupa.com/t/choosing-between-ai-app-builders-for-a-small-side-project-how-do-you-decide/683978 "2026-11-10T15:21:51Z")

</div>

I’m a programmer by trade but mostly work on backend stuff, and I want to put together a small web app for tracking personal reading lists. Nothing fancy, just a few forms, a list view, and maybe some basic filtering. I…

---

## [Spot the bug - #189: Button](https://forum.kirupa.com/t/spot-the-bug-189-button/683982)

<div class="topic-metadata">

**Author:** [@HariSeldon](https://forum.kirupa.com/u/HariSeldon)\
**Replies:** 0\
**Last updated:** [November 9, 2026, 4:05pm UTC](https://forum.kirupa.com/t/spot-the-bug-189-button/683982 "2026-11-09T16:05:21Z")

</div>

A tiny web snippet with a quirky bug hiding inside. \<!DOCTYPE html\> \<html\> \<head\> \<meta charset="utf-8" /\> \<title\>Spot the Bug - quirky timer\</title\> \<style\> .box { width: 200px; height: 100px; background: #f0…

---

## [Spot the bug - #188: Textbox](https://forum.kirupa.com/t/spot-the-bug-188-textbox/683958)

<div class="topic-metadata">

**Author:** [@sarah\_connor](https://forum.kirupa.com/u/sarah_connor)\
**Replies:** 2\
**Last updated:** [November 7, 2026, 11:19pm UTC](https://forum.kirupa.com/t/spot-the-bug-188-textbox/683958 "2026-11-07T23:19:39Z")

</div>

Tiny regex quest hides a subtle flaw. \<!DOCTYPE html\> \<html\> \<head\> \<meta charset="UTF-8" /\> \<title\>Spot the Bug: Regex Edition\</title\> \<style\> body { font-family: sans-serif; padding: 1rem; } .box { borde…

---

## [Algorithms Challenge - #2: Sliding Window](https://forum.kirupa.com/t/algorithms-challenge-2-sliding-window/683945)

<div class="topic-metadata">

**Author:** [@VaultBoy](https://forum.kirupa.com/u/VaultBoy)\
**Replies:** 2\
**Last updated:** [November 7, 2026, 7:13am UTC](https://forum.kirupa.com/t/algorithms-challenge-2-sliding-window/683945 "2026-11-07T07:13:40Z")

</div>

Create a function that finds the maximum sum of any subarray of fixed size k in a given array of integers. Return -1 if k is invalid (k \<= 0 or k \> length of the array). Examples: max\_subarray\_sum\_of\_size\_k(\[1,4,2,10,…

---

## [Spot the bug - #162: Task Runner Queue](https://forum.kirupa.com/t/spot-the-bug-162-task-runner-queue/683558)

<div class="topic-metadata">

**Author:** [@sora](https://forum.kirupa.com/u/sora)\
**Replies:** 2\
**Last updated:** [November 5, 2026, 11:20pm UTC](https://forum.kirupa.com/t/spot-the-bug-162-task-runner-queue/683558 "2026-11-05T23:20:12Z")

</div>

Tricky closure bug lurking in this delayed queue processor. function runTasks(tasks, delay) { for (var i = 0; i \< tasks.length; i++) { setTimeout(function() { tasks\[i\](); }, delay \* i); } } Reply with…

---

## [Using addEventListener's \`{ once: true }\` option for single-shot events](https://forum.kirupa.com/t/using-addeventlisteners-once-true-option-for-single-shot-events/683855)

<div class="topic-metadata">

**Author:** [@Yoshiii](https://forum.kirupa.com/u/Yoshiii)\
**Replies:** 2\
**Last updated:** [November 5, 2026, 5:14pm UTC](https://forum.kirupa.com/t/using-addeventlisteners-once-true-option-for-single-shot-events/683855 "2026-11-05T17:14:15Z")

</div>

Source: HariSeldon, post #2, Yoshiii, post #3 It’s super cool that addEventListener lets us have multiple handlers for the same event, like Hariseldon mentioned in the quiz discussion (JS Quiz: Easy: Simplest DOM event …

---

## [Spot the bug - #167: Member Badge Verifier](https://forum.kirupa.com/t/spot-the-bug-167-member-badge-verifier/683606)

<div class="topic-metadata">

**Author:** [@sora](https://forum.kirupa.com/u/sora)\
**Replies:** 5\
**Last updated:** [November 5, 2026, 2:03pm UTC](https://forum.kirupa.com/t/spot-the-bug-167-member-badge-verifier/683606 "2026-11-05T14:03:11Z")

</div>

Why does this badge validator alternate between valid and invalid? const BADGE\_PATTERNS = { scout: /^SCOUT-\[A-Z\]{3}-\\d{4}$/g, ranger: /^RANGER-\[A-Z\]{2}-\\d{3}$/g, pilot: /^PILOT-\\d{4}-\[A-Z\]{2}$/g }; function valid…

---

## [Typewriter Effect : Frontend Coding Exercise](https://forum.kirupa.com/t/typewriter-effect-frontend-coding-exercise/683598)

<div class="topic-metadata">

**Author:** [@kirupa](https://forum.kirupa.com/u/kirupa)\
**Replies:** 2\
**Last updated:** [November 5, 2026, 10:02am UTC](https://forum.kirupa.com/t/typewriter-effect-frontend-coding-exercise/683598 "2026-11-05T10:02:08Z")

</div>

This is where you can share your code for solving the Typewriter Effect exercise :slight\_smile:

---

## [Rock, Paper, Scissors : Frontend Coding Exercise](https://forum.kirupa.com/t/rock-paper-scissors-frontend-coding-exercise/683593)

<div class="topic-metadata">

**Author:** [@kirupa](https://forum.kirupa.com/u/kirupa)\
**Replies:** 2\
**Last updated:** [November 4, 2026, 10:01pm UTC](https://forum.kirupa.com/t/rock-paper-scissors-frontend-coding-exercise/683593 "2026-11-04T22:01:22Z")

</div>

This is where you can share your code for solving the Rock, Paper, Scissors exercise :slight\_smile:

---

## [Spot the bug - #187: Power Dispenser](https://forum.kirupa.com/t/spot-the-bug-187-power-dispenser/683848)

<div class="topic-metadata">

**Author:** [@Quelly](https://forum.kirupa.com/u/Quelly)\
**Replies:** 4\
**Last updated:** [November 4, 2026, 9:59pm UTC](https://forum.kirupa.com/t/spot-the-bug-187-power-dispenser/683848 "2026-11-04T21:59:33Z")

</div>

Something subtle goes wrong inside this quirky energy dispenser logic. function dispenseEnergy(batteryCharge, requestedJoules) { let delivered = 0; try { if (requestedJoules \<= 0) { throw new RangeError("R…

---

## [Spot the bug - #173: Dungeon Trapdoor Trigger](https://forum.kirupa.com/t/spot-the-bug-173-dungeon-trapdoor-trigger/683701)

<div class="topic-metadata">

**Author:** [@WaffleFries](https://forum.kirupa.com/u/WaffleFries)\
**Replies:** 5\
**Last updated:** [November 4, 2026, 6:02pm UTC](https://forum.kirupa.com/t/spot-the-bug-173-dungeon-trapdoor-trigger/683701 "2026-11-04T18:02:04Z")

</div>

Why is this secret trapdoor triggering on every nested click? \<div id="trapdoor" style="padding: 24px; background: #332;"\> \<button id="latch"\>Unlock Hatch\</button\> \<span id="status"\>Locked\</span\> \</div\> \<script\> …

---

## [JS Quiz: Easy: Simplest DOM event listener](https://forum.kirupa.com/t/js-quiz-easy-simplest-dom-event-listener/683700)

<div class="topic-metadata">

**Author:** [@Yoshiii](https://forum.kirupa.com/u/Yoshiii)\
**Replies:** 5\
**Last updated:** [November 4, 2026, 2:06pm UTC](https://forum.kirupa.com/t/js-quiz-easy-simplest-dom-event-listener/683700 "2026-11-04T14:06:29Z")

</div>

Which line correctly adds a click event listener to the myButton element? const myButton = document.getElementById('myButton'); // Which line goes here? poll

---

## [Coding Challenge - #31: Clamp Number Range](https://forum.kirupa.com/t/coding-challenge-31-clamp-number-range/683709)

<div class="topic-metadata">

**Author:** [@Baymax](https://forum.kirupa.com/u/Baymax)\
**Replies:** 6\
**Last updated:** [November 4, 2026, 9:58am UTC](https://forum.kirupa.com/t/coding-challenge-31-clamp-number-range/683709 "2026-11-04T09:58:54Z")

</div>

Write a function clamp(value, min, max) that restricts a given number to fall within an inclusive minimum and maximum range. For example, clamp(12, 0, 10) should return 10, clamp(-4, 0, 10) should return 0, and clamp(5, …

---

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

<div class="topic-metadata">

**Author:** [@Quelly](https://forum.kirupa.com/u/Quelly)\
**Replies:** 7\
**Last updated:** [November 4, 2026, 5:58am UTC](https://forum.kirupa.com/t/spot-the-bug-176-duplicate-finder-helper/683751 "2026-11-04T05:58:35Z")

</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 - #166: Gamer Tag Tagger](https://forum.kirupa.com/t/spot-the-bug-166-gamer-tag-tagger/683586)

<div class="topic-metadata">

**Author:** [@Ellen1979](https://forum.kirupa.com/u/Ellen1979)\
**Replies:** 7\
**Last updated:** [November 4, 2026, 1:59am UTC](https://forum.kirupa.com/t/spot-the-bug-166-gamer-tag-tagger/683586 "2026-11-04T01:59:33Z")

</div>

Why is this username padder producing weirdly short results? function padTag(tag, length = 8) { const cleanTag = tag.trimStart(); return cleanTag.padStart(length - cleanTag.length, "~"); } Reply with what is broken…

---

## [Spot the bug - #171: Hex Palette Blender](https://forum.kirupa.com/t/spot-the-bug-171-hex-palette-blender/683663)

<div class="topic-metadata">

**Author:** [@ArthurDent](https://forum.kirupa.com/u/ArthurDent)\
**Replies:** 4\
**Last updated:** [November 3, 2026, 5:57pm UTC](https://forum.kirupa.com/t/spot-the-bug-171-hex-palette-blender/683663 "2026-11-03T17:57:29Z")

</div>

Color mixer function keeps generating invalid hexadecimal string values. function parseHexColor(hex) { const clean = hex.replace('#', ''); const num = parseInt(clean, 16); return { r: (num \>\> 16) & 255, g:…

---

## [Spot the bug - #172: Retina Canvas Renderer](https://forum.kirupa.com/t/spot-the-bug-172-retina-canvas-renderer/683678)

<div class="topic-metadata">

**Author:** [@VaultBoy](https://forum.kirupa.com/u/VaultBoy)\
**Replies:** 3\
**Last updated:** [November 3, 2026, 10:01am UTC](https://forum.kirupa.com/t/spot-the-bug-172-retina-canvas-renderer/683678 "2026-11-03T10:01:23Z")

</div>

Why are these radar blips scaling up all wrong on resize? function setupRadarDisplay(canvas, blips) { const ctx = canvas.getContext('2d'); const dpr = window.devicePixelRatio || 1; const rect = canvas.getBoundingC…

---

## [Stopwatch : Frontend Coding Exercise](https://forum.kirupa.com/t/stopwatch-frontend-coding-exercise/683597)

<div class="topic-metadata">

**Author:** [@kirupa](https://forum.kirupa.com/u/kirupa)\
**Replies:** 2\
**Last updated:** [November 3, 2026, 2:01am UTC](https://forum.kirupa.com/t/stopwatch-frontend-coding-exercise/683597 "2026-11-03T02:01:08Z")

</div>

This is where you can share your code for solving the Stopwatch exercise :slight\_smile:

---

## [Palindrome Checker : Frontend Coding Exercise](https://forum.kirupa.com/t/palindrome-checker-frontend-coding-exercise/683591)

<div class="topic-metadata">

**Author:** [@kirupa](https://forum.kirupa.com/u/kirupa)\
**Replies:** 2\
**Last updated:** [November 2, 2026, 5:57pm UTC](https://forum.kirupa.com/t/palindrome-checker-frontend-coding-exercise/683591 "2026-11-02T17:57:41Z")

</div>

This is where you can share your code for solving the Palindrome Checker exercise :slight\_smile:

---

## [Dark Mode Toggle : Frontend Coding Exercise](https://forum.kirupa.com/t/dark-mode-toggle-frontend-coding-exercise/683599)

<div class="topic-metadata">

**Author:** [@kirupa](https://forum.kirupa.com/u/kirupa)\
**Replies:** 3\
**Last updated:** [November 1, 2026, 9:58pm UTC](https://forum.kirupa.com/t/dark-mode-toggle-frontend-coding-exercise/683599 "2026-11-01T21:58:25Z")

</div>

This is where you can share your code for solving the Dark Mode Toggle exercise :slight\_smile:

---

## [Coding Challenge - #32: Debounce Function](https://forum.kirupa.com/t/coding-challenge-32-debounce-function/683748)

<div class="topic-metadata">

**Author:** [@sora](https://forum.kirupa.com/u/sora)\
**Replies:** 3\
**Last updated:** [November 1, 2026, 5:58pm UTC](https://forum.kirupa.com/t/coding-challenge-32-debounce-function/683748 "2026-11-01T17:58:36Z")

</div>

Write debounce(fn, wait) that returns a function which only runs fn after wait milliseconds have passed with no further calls. Calling it repeatedly should reset the timer. function debounce(fn, wait) { // your code h…

---

## [Spot the bug - #174: Cart Coupon Evaluator](https://forum.kirupa.com/t/spot-the-bug-174-cart-coupon-evaluator/683715)

<div class="topic-metadata">

**Author:** [@VaultBoy](https://forum.kirupa.com/u/VaultBoy)\
**Replies:** 5\
**Last updated:** [November 1, 2026, 1:58pm UTC](https://forum.kirupa.com/t/spot-the-bug-174-cart-coupon-evaluator/683715 "2026-11-01T13:58:13Z")

</div>

Why is this checkout coupon always triggering the default tier? function resolveDiscountTier(subtotal, promoCode) { let tier = 'STANDARD'; const isVip = promoCode === 'VIP\_HERO'; switch (subtotal) { case subt…

---

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

<div class="topic-metadata">

**Author:** [@Quelly](https://forum.kirupa.com/u/Quelly)\
**Replies:** 3\
**Last updated:** [November 1, 2026, 12:47pm UTC](https://forum.kirupa.com/t/spot-the-bug-179-email-signup-form/683784 "2026-11-01T12:47:39Z")

</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) =\> { …

---

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

<div class="topic-metadata">

**Author:** [@VaultBoy](https://forum.kirupa.com/u/VaultBoy)\
**Replies:** 4\
**Last updated:** [October 31, 2026, 6:04am UTC](https://forum.kirupa.com/t/spot-the-bug-177-moving-sprite-position/683764 "2026-10-31T06:04:43Z")

</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.

---

## [Tip Calculator : Frontend Coding Exercise](https://forum.kirupa.com/t/tip-calculator-frontend-coding-exercise/683596)

<div class="topic-metadata">

**Author:** [@kirupa](https://forum.kirupa.com/u/kirupa)\
**Replies:** 9\
**Last updated:** [October 30, 2026, 10:23pm UTC](https://forum.kirupa.com/t/tip-calculator-frontend-coding-exercise/683596 "2026-10-30T22:23:35Z")

</div>

This is where you can share your code for solving the Tip Calculator exercise :slight\_smile:

---

## [Coding Challenge - #33: Group By Key](https://forum.kirupa.com/t/coding-challenge-33-group-by-key/683770)

<div class="topic-metadata">

**Author:** [@ArthurDent](https://forum.kirupa.com/u/ArthurDent)\
**Replies:** 4\
**Last updated:** [October 30, 2026, 6:06pm UTC](https://forum.kirupa.com/t/coding-challenge-33-group-by-key/683770 "2026-10-30T18:06:52Z")

</div>

Write groupBy(items, key) that returns an object grouping the array of objects by the given property. groupBy(\[{t:"a",v:1},{t:"b",v:2},{t:"a",v:3}\], "t") should give {a:\[{t:"a",v:1},{t:"a",v:3}\], b:\[{t:"b",v:2}\]}. funct…

---

## [Spot the bug - #182: Particle Trail Canvas](https://forum.kirupa.com/t/spot-the-bug-182-particle-trail-canvas/683804)

<div class="topic-metadata">

**Author:** [@Yoshiii](https://forum.kirupa.com/u/Yoshiii)\
**Replies:** 2\
**Last updated:** [October 30, 2026, 10:04am UTC](https://forum.kirupa.com/t/spot-the-bug-182-particle-trail-canvas/683804 "2026-10-30T10:04:13Z")

</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 - #178: Tag Normalizer](https://forum.kirupa.com/t/spot-the-bug-178-tag-normalizer/683773)

<div class="topic-metadata">

**Author:** [@Yoshiii](https://forum.kirupa.com/u/Yoshiii)\
**Replies:** 3\
**Last updated:** [October 30, 2026, 6:09am UTC](https://forum.kirupa.com/t/spot-the-bug-178-tag-normalizer/683773 "2026-10-30T06:09:01Z")

</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.

---

## [What’s a Small JavaScript Bug That Taught You Something?](https://forum.kirupa.com/t/what-s-a-small-javascript-bug-that-taught-you-something/683152)

<div class="topic-metadata">

**Author:** [@Apexcodes](https://forum.kirupa.com/u/Apexcodes)\
**Replies:** 6\
**Last updated:** [October 30, 2026, 5:20am UTC](https://forum.kirupa.com/t/what-s-a-small-javascript-bug-that-taught-you-something/683152 "2026-10-30T05:20:08Z")

</div>

Some of the most useful JavaScript lessons seem to come from bugs that initially look completely harmless. Maybe a button works twice instead of once, an event listener gets attached multiple times, a value is unexpecte…

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