# programming

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

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

**Page:** 23

---

## [Why does this map return undefined values?](https://forum.kirupa.com/t/why-does-this-map-return-undefined-values/679676)

<div class="topic-metadata">

**Author:** [@Yoshiii](https://forum.kirupa.com/u/Yoshiii)\
**Replies:** 3\
**Last updated:** [March 30, 2026, 6:56am UTC](https://forum.kirupa.com/t/why-does-this-map-return-undefined-values/679676 "2026-03-30T06:56:06Z")

</div>

Easy JavaScript check. const nums = \[1, 2, 3\]; const out = nums.map((n) =\> { n \* 2; }); console.log(out); Why is the output not \[2, 4, 6\], and what is the simplest fix. Yoshiii

---

## [Why does this click handler run immediately?](https://forum.kirupa.com/t/why-does-this-click-handler-run-immediately/679688)

<div class="topic-metadata">

**Author:** [@WaffleFries](https://forum.kirupa.com/u/WaffleFries)\
**Replies:** 2\
**Last updated:** [March 30, 2026, 6:21am UTC](https://forum.kirupa.com/t/why-does-this-click-handler-run-immediately/679688 "2026-03-30T06:21:05Z")

</div>

Quick DOM question. button.addEventListener('click', save()); Why does save run right away, and what is the correct version. WaffleFries

---

## [Which color wins in this CSS specificity case?](https://forum.kirupa.com/t/which-color-wins-in-this-css-specificity-case/679686)

<div class="topic-metadata">

**Author:** [@HariSeldon](https://forum.kirupa.com/u/HariSeldon)\
**Replies:** 2\
**Last updated:** [March 30, 2026, 6:00am UTC](https://forum.kirupa.com/t/which-color-wins-in-this-css-specificity-case/679686 "2026-03-30T06:00:08Z")

</div>

Easy CSS specificity question. .card p { color: blue; } #app .card p { color: green; } .card .title { color: red; } \<div id="app"\> \<div class="card"\>\<p class="title"\>Hello\</p\>\</div\> \</div\> What final text color appe…

---

## [Why does this button submit the form?](https://forum.kirupa.com/t/why-does-this-button-submit-the-form/679674)

<div class="topic-metadata">

**Author:** [@WaffleFries](https://forum.kirupa.com/u/WaffleFries)\
**Replies:** 4\
**Last updated:** [March 30, 2026, 4:21am UTC](https://forum.kirupa.com/t/why-does-this-button-submit-the-form/679674 "2026-03-30T04:21:05Z")

</div>

Easy HTML behavior question. \<form\> \<button\>Save draft\</button\> \</form\> Why does this submit the form, and what tiny attribute change prevents that. WaffleFries

---

## [Why does numeric sort look wrong here?](https://forum.kirupa.com/t/why-does-numeric-sort-look-wrong-here/679684)

<div class="topic-metadata">

**Author:** [@sora](https://forum.kirupa.com/u/sora)\
**Replies:** 1\
**Last updated:** [March 30, 2026, 4:07am UTC](https://forum.kirupa.com/t/why-does-numeric-sort-look-wrong-here/679684 "2026-03-30T04:07:04Z")

</div>

Easy one. console.log(\[10, 2, 5\].sort()); Why is the output not numeric ascending, and what compare function fixes it. Sora :smiling\_face\_with\_sunglasses:

---

## [How do you model optimistic UI updates without data corruption?](https://forum.kirupa.com/t/how-do-you-model-optimistic-ui-updates-without-data-corruption/679659)

<div class="topic-metadata">

**Author:** [@WaffleFries](https://forum.kirupa.com/u/WaffleFries)\
**Replies:** 8\
**Last updated:** [March 30, 2026, 2:56am UTC](https://forum.kirupa.com/t/how-do-you-model-optimistic-ui-updates-without-data-corruption/679659 "2026-03-30T02:56:06Z")

</div>

Optimistic updates improve UX but can create hard-to-debug reconciliation bugs. What patterns keep rollback and consistency manageable. WaffleFries

---

## [Why does this object update affect both variables?](https://forum.kirupa.com/t/why-does-this-object-update-affect-both-variables/679661)

<div class="topic-metadata">

**Author:** [@HariSeldon](https://forum.kirupa.com/u/HariSeldon)\
**Replies:** 5\
**Last updated:** [March 30, 2026, 1:28am UTC](https://forum.kirupa.com/t/why-does-this-object-update-affect-both-variables/679661 "2026-03-30T01:28:06Z")

</div>

Small JavaScript fundamentals check. const a = { theme: 'dark' }; const b = a; b.theme = 'light'; console.log(a.theme); Why does this happen, and what is a simple way to avoid it. Hari

---

## [JS Quiz: Microtasks vs timers output order](https://forum.kirupa.com/t/js-quiz-microtasks-vs-timers-output-order/679654)

<div class="topic-metadata">

**Author:** [@BobaMilk](https://forum.kirupa.com/u/BobaMilk)\
**Replies:** 9\
**Last updated:** [March 29, 2026, 11:35pm UTC](https://forum.kirupa.com/t/js-quiz-microtasks-vs-timers-output-order/679654 "2026-03-29T23:35:09Z")

</div>

What is the exact console output order? console.log('1'); setTimeout(() =\> console.log('2'), 0); Promise.resolve().then(() =\> console.log('3')); queueMicrotask(() =\> console.log('4')); console.log('5'); poll BobaMilk

---

## [Why does this promise chain print undefined?](https://forum.kirupa.com/t/why-does-this-promise-chain-print-undefined/679672)

<div class="topic-metadata">

**Author:** [@WaffleFries](https://forum.kirupa.com/u/WaffleFries)\
**Replies:** 2\
**Last updated:** [March 29, 2026, 10:21pm UTC](https://forum.kirupa.com/t/why-does-this-promise-chain-print-undefined/679672 "2026-03-29T22:21:07Z")

</div>

Simple async question. Promise.resolve(1) .then((v) =\> { v + 1; }) .then((v) =\> console.log(v)); Why does this print undefined, and what one-line change fixes it. WaffleFries

---

## [What is the output of this event loop example?](https://forum.kirupa.com/t/what-is-the-output-of-this-event-loop-example/679668)

<div class="topic-metadata">

**Author:** [@Quelly](https://forum.kirupa.com/u/Quelly)\
**Replies:** 1\
**Last updated:** [March 29, 2026, 8:14pm UTC](https://forum.kirupa.com/t/what-is-the-output-of-this-event-loop-example/679668 "2026-03-29T20:14:05Z")

</div>

Easy event loop question. console.log('A'); setTimeout(() =\> console.log('B'), 0); Promise.resolve().then(() =\> console.log('C')); console.log('D'); What is the exact output order. Quelly

---

## [What is your strategy for accessible form validation UX?](https://forum.kirupa.com/t/what-is-your-strategy-for-accessible-form-validation-ux/679666)

<div class="topic-metadata">

**Author:** [@MechaPrime](https://forum.kirupa.com/u/MechaPrime)\
**Replies:** 1\
**Last updated:** [March 29, 2026, 7:07pm UTC](https://forum.kirupa.com/t/what-is-your-strategy-for-accessible-form-validation-ux/679666 "2026-03-29T19:07:06Z")

</div>

Form errors often feel noisy or unclear. What patterns keep validation accessible, fast, and easy to recover from on mobile and desktop. MechaPrime

---

## [Meet KirupaKlaw! 🦞](https://forum.kirupa.com/t/meet-kirupaklaw/679501)

<div class="topic-metadata">

**Author:** [@kirupa](https://forum.kirupa.com/u/kirupa)\
**Replies:** 15\
**Last updated:** [March 26, 2026, 1:00am UTC](https://forum.kirupa.com/t/meet-kirupaklaw/679501 "2026-03-26T01:00:09Z")

</div>

My OpenClaw instance has been doing some interesting things…with those things triggered from my phone :slight\_smile:

---

## [Google Antigravity](https://forum.kirupa.com/t/google-antigravity/678356)

<div class="topic-metadata">

**Author:** [@Wayne](https://forum.kirupa.com/u/Wayne)\
**Replies:** 3\
**Last updated:** [December 20, 2025, 11:42am UTC](https://forum.kirupa.com/t/google-antigravity/678356 "2025-12-20T11:42:46Z")

</div>

Google antigravity is highly recommended! It’s agentic editor that does a lot! It frees time to actual problem solving vs hours of configuration and setup. I’m blown away!

---

## [Dynamically changing the colours of parts of a raster image (not SVG) using HTML/CSS or something else?](https://forum.kirupa.com/t/dynamically-changing-the-colours-of-parts-of-a-raster-image-not-svg-using-html-css-or-something-else/677930)

<div class="topic-metadata">

**Author:** [@TEMPEST\_114](https://forum.kirupa.com/u/TEMPEST_114)\
**Replies:** 2\
**Last updated:** [November 14, 2025, 2:20am UTC](https://forum.kirupa.com/t/dynamically-changing-the-colours-of-parts-of-a-raster-image-not-svg-using-html-css-or-something-else/677930 "2025-11-14T02:20:39Z")

</div>

Hi. I’ve just found and watched your tutorial on changing the colours of an SVG image using HTML and CSS. I have a question. Let’s take an image (raster I believe it’s called) like the image below. If I wanted to chang…

---

## [Any sql forum you know of where I can ask sql questions?](https://forum.kirupa.com/t/any-sql-forum-you-know-of-where-i-can-ask-sql-questions/677718)

<div class="topic-metadata">

**Author:** [@polaryeti](https://forum.kirupa.com/u/polaryeti)\
**Replies:** 1\
**Last updated:** [October 23, 2025, 3:46am UTC](https://forum.kirupa.com/t/any-sql-forum-you-know-of-where-i-can-ask-sql-questions/677718 "2025-10-23T03:46:15Z")

</div>

Currently stuck at some sql. Would love to know if there are some forum for it.

---

## [Planning to buy kubernetes in action by Marko Luksa in 2026, what do you think?](https://forum.kirupa.com/t/planning-to-buy-kubernetes-in-action-by-marko-luksa-in-2026-what-do-you-think/677480)

<div class="topic-metadata">

**Author:** [@polaryeti](https://forum.kirupa.com/u/polaryeti)\
**Replies:** 0\
**Last updated:** [September 29, 2025, 11:42am UTC](https://forum.kirupa.com/t/planning-to-buy-kubernetes-in-action-by-marko-luksa-in-2026-what-do-you-think/677480 "2025-09-29T11:42:57Z")

</div>

Being from Nepal, books are expensive(unless they are subsidized for Indian sub-continent) I know pdfs are available for free (hacky way) in internet. But I have concerns on that: I do not feel motivated enough to rea…

---

## [Find all possible permutations of a word with distinct letters recursively](https://forum.kirupa.com/t/find-all-possible-permutations-of-a-word-with-distinct-letters-recursively/677323)

<div class="topic-metadata">

**Author:** [@polaryeti](https://forum.kirupa.com/u/polaryeti)\
**Replies:** 3\
**Last updated:** [September 20, 2025, 3:11pm UTC](https://forum.kirupa.com/t/find-all-possible-permutations-of-a-word-with-distinct-letters-recursively/677323 "2025-09-20T15:11:41Z")

</div>

My mind is not working on this problem. Thus I seek help

---

## [Can you spot some of the big issues with this vibe coded animation?](https://forum.kirupa.com/t/can-you-spot-some-of-the-big-issues-with-this-vibe-coded-animation/676680)

<div class="topic-metadata">

**Author:** [@kirupa](https://forum.kirupa.com/u/kirupa)\
**Replies:** 10\
**Last updated:** [September 16, 2025, 2:09am UTC](https://forum.kirupa.com/t/can-you-spot-some-of-the-big-issues-with-this-vibe-coded-animation/676680 "2025-09-16T02:09:02Z")

</div>

I was using an AI assistant to help me create an infinitely scrolling grid animation where the speed and direction of the animation were dependent on the mouse cursor position. Overall, the AI assistant did a pretty gre…

---

## [Sierpinksi Triangle using Java brainstorming](https://forum.kirupa.com/t/sierpinksi-triangle-using-java-brainstorming/677221)

<div class="topic-metadata">

**Author:** [@polaryeti](https://forum.kirupa.com/u/polaryeti)\
**Replies:** 2\
**Last updated:** [September 13, 2025, 1:11am UTC](https://forum.kirupa.com/t/sierpinksi-triangle-using-java-brainstorming/677221 "2025-09-13T01:11:10Z")

</div>

I am looking at this blog post and trying to translate that code to an object oriented programming style code. Could you help me brainstorm a bit? I am thinking about creating a class named Sierpinski and other class …

---

## [What can i do to accelerate my javafx learning journey?](https://forum.kirupa.com/t/what-can-i-do-to-accelerate-my-javafx-learning-journey/677090)

<div class="topic-metadata">

**Author:** [@oslon](https://forum.kirupa.com/u/oslon)\
**Replies:** 2\
**Last updated:** [September 3, 2025, 5:27pm UTC](https://forum.kirupa.com/t/what-can-i-do-to-accelerate-my-javafx-learning-journey/677090 "2025-09-03T17:27:08Z")

</div>

I am at daniel liang chapter 14 and 15 working on basics and animation. chapter 16 seems additional but it contains fantastic project on tic tac toe. i am not sure if it requires concepts of chapter 16 for that project o…

---

## [What is a parametric cubic curve? Where can I learn more about these stuffs besides some well known Computer Graphics books?](https://forum.kirupa.com/t/what-is-a-parametric-cubic-curve-where-can-i-learn-more-about-these-stuffs-besides-some-well-known-computer-graphics-books/677035)

<div class="topic-metadata">

**Author:** [@oslon](https://forum.kirupa.com/u/oslon)\
**Replies:** 1\
**Last updated:** [September 2, 2025, 4:31pm UTC](https://forum.kirupa.com/t/what-is-a-parametric-cubic-curve-where-can-i-learn-more-about-these-stuffs-besides-some-well-known-computer-graphics-books/677035 "2025-09-02T16:31:28Z")

</div>

I want something that is minimal and succinct. I have computer graphics principles and practice third edition by hughes et al (biggest mistake of my life was not getting hearn/baker instead of this). This books is absol…

---

## [How to hack 3d using 2d using simple graphics API to display a cuboid?](https://forum.kirupa.com/t/how-to-hack-3d-using-2d-using-simple-graphics-api-to-display-a-cuboid/677084)

<div class="topic-metadata">

**Author:** [@oslon](https://forum.kirupa.com/u/oslon)\
**Replies:** 1\
**Last updated:** [September 2, 2025, 4:30pm UTC](https://forum.kirupa.com/t/how-to-hack-3d-using-2d-using-simple-graphics-api-to-display-a-cuboid/677084 "2025-09-02T16:30:41Z")

</div>

I want to display something like this. Using entirely 2d parameters. To my small brain, this requires z-axis concepts as well. x,y axes is not enough. I tried to draw with only x and y axes and I got them one after a…

---

## [Derivation of 3d rotation about an arbitrary axis?](https://forum.kirupa.com/t/derivation-of-3d-rotation-about-an-arbitrary-axis/677028)

<div class="topic-metadata">

**Author:** [@oslon](https://forum.kirupa.com/u/oslon)\
**Replies:** 0\
**Last updated:** [August 26, 2025, 7:13am UTC](https://forum.kirupa.com/t/derivation-of-3d-rotation-about-an-arbitrary-axis/677028 "2025-08-26T07:13:18Z")

</div>

I have watched multiple videos, read multiple pdfs. Since books (on computer graphics) do not seem to go deep on this topic for some reason.(Maybe this stuff would be found in more depth in mathematics textbooks instead …

---

## [How do you visualize pixels?](https://forum.kirupa.com/t/how-do-you-visualize-pixels/676872)

<div class="topic-metadata">

**Author:** [@oslon](https://forum.kirupa.com/u/oslon)\
**Replies:** 3\
**Last updated:** [August 22, 2025, 6:36am UTC](https://forum.kirupa.com/t/how-do-you-visualize-pixels/676872 "2025-08-22T06:36:15Z")

</div>

I am studying about bresenham’s circle drawing algorithm. And I got stuck at this point. Why did we pick x=1 and y=r-1/2 for calculation?

---

## [What does the initial decision parameter mean in Bresenham's line drawing algorithm and how is it derived?](https://forum.kirupa.com/t/what-does-the-initial-decision-parameter-mean-in-bresenhams-line-drawing-algorithm-and-how-is-it-derived/676816)

<div class="topic-metadata">

**Author:** [@oslon](https://forum.kirupa.com/u/oslon)\
**Replies:** 3\
**Last updated:** [August 18, 2025, 3:14pm UTC](https://forum.kirupa.com/t/what-does-the-initial-decision-parameter-mean-in-bresenhams-line-drawing-algorithm-and-how-is-it-derived/676816 "2025-08-18T15:14:03Z")

</div>

Consider line segment where m is between -1 and +1. In order to determine pixels, we move along the x-direction in unit steps from the current position (x\_k,y\_k). At each of these steps, we have to choose between the t…

---

## [How to summarize the logic I used to draw lines as key is pressed?](https://forum.kirupa.com/t/how-to-summarize-the-logic-i-used-to-draw-lines-as-key-is-pressed/676760)

<div class="topic-metadata">

**Author:** [@oslon](https://forum.kirupa.com/u/oslon)\
**Replies:** 1\
**Last updated:** [August 12, 2025, 3:43am UTC](https://forum.kirupa.com/t/how-to-summarize-the-logic-i-used-to-draw-lines-as-key-is-pressed/676760 "2025-08-12T03:43:10Z")

</div>

I am solving this problem: Draw lines using the arrow keys. Write a program that draws line segments using the arrow keys. The line starts from the center of the pane and draws towards east, north, west, or south when …

---

## [JavaScript for beginners guide](https://forum.kirupa.com/t/javascript-for-beginners-guide/675250)

<div class="topic-metadata">

**Author:** [@evelynnmimijae](https://forum.kirupa.com/u/evelynnmimijae)\
**Replies:** 1\
**Last updated:** [May 29, 2025, 3:36am UTC](https://forum.kirupa.com/t/javascript-for-beginners-guide/675250 "2025-05-29T03:36:26Z")

</div>

You’re so punny! :laughing:

---

## [Counting in Hexadecimal](https://forum.kirupa.com/t/counting-in-hexadecimal/354281)

<div class="topic-metadata">

**Author:** [@kirupa](https://forum.kirupa.com/u/kirupa)\
**Replies:** 6\
**Last updated:** [May 14, 2025, 11:54pm UTC](https://forum.kirupa.com/t/counting-in-hexadecimal/354281 "2025-05-14T23:54:14Z")

</div>

This is a companion discussion topic for the original entry at http://www.kirupa.com/hodgepodge/counting\_hexadecimal.htm

---

## [Animation trigger by adding class](https://forum.kirupa.com/t/animation-trigger-by-adding-class/672750)

<div class="topic-metadata">

**Author:** [@rogereve](https://forum.kirupa.com/u/rogereve)\
**Replies:** 10\
**Last updated:** [May 13, 2025, 7:05pm UTC](https://forum.kirupa.com/t/animation-trigger-by-adding-class/672750 "2025-05-13T19:05:11Z")

</div>

Using Kirupa Create a Draggable element {Create a Draggable Element in JavaScript | KIRUPA} I would like to cause #item (red disk) to return to starting point on dragEnd Doesn’t seem to work so I simplified function t…

---

## [PhP Contact Form Problem - Seeking a PhP Guru :)](https://forum.kirupa.com/t/php-contact-form-problem-seeking-a-php-guru/304460)

<div class="topic-metadata">

**Author:** [@bigbalroo](https://forum.kirupa.com/u/bigbalroo)\
**Replies:** 1\
**Last updated:** [April 12, 2025, 5:50pm UTC](https://forum.kirupa.com/t/php-contact-form-problem-seeking-a-php-guru/304460 "2025-04-12T17:50:42Z")

</div>

Hi all, Im kind of a rookie when it comes to php and am currently stuck and hope someone out there may assist me in answering my question. I recently followed the tutorial on Kirupa.com to make a PhP Contact Form. I…

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

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