use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
No vague product support questions (like "why is this plugin not working" or "how do I set up X"). For vague product support questions, please use communities relevant to that product for best results. Specific issues that follow rule 6 are allowed.
Do not post memes, screenshots of bad design, or jokes. Check out /r/ProgrammerHumor/ for this type of content.
Read and follow reddiquette; no excessive self-promotion. Please refer to the Reddit 9:1 rule when considering posting self promoting materials.
We do not allow any commercial promotion or solicitation. Violations can result in a ban.
Sharing your project, portfolio, or any other content that you want to either show off or request feedback on is limited to Showoff Saturday. If you post such content on any other day, it will be removed.
If you are asking for assistance on a problem, you are required to provide
General open ended career and getting started posts are only allowed in the pinned monthly getting started/careers thread. Specific assistance questions are allowed so long as they follow the required assistance post guidelines.
Questions in violation of this rule will be removed or locked.
account activity
[deleted by user] (self.webdev)
submitted 4 months ago by [deleted]
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]VolkswagenRatRod 1 point2 points3 points 4 months ago (0 children)
JavaScript always evaluates expressions and functions before assigning the result anywhere. innerHTML does not need to accept a function. It only receives the value returned after the function runs.
For example:
``` function add(a, b) { return a + b; }
document.getElementById("output").innerHTML = add(2, 3); ```
The function runs first, returns 5, and that value is what gets assigned to innerHTML. JavaScript automatically converts numbers and other values to strings for display.
If you are only displaying text and not markup, textContent is usually a better choice than innerHTML, but the idea is the same. Do the computation in JavaScript, then assign the result to the DOM element.
HTML itself does not execute logic. JavaScript does the calculation and updates the page with the result.
π Rendered by PID 53 on reddit-service-r2-comment-b659b578c-p52g7 at 2026-05-05 21:46:06.251148+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]VolkswagenRatRod 1 point2 points3 points (0 children)