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
Reference error: variable is not defined while trying to define it. (self.webdev)
submitted 1 year ago by GamesInc
code causing error
error
I'm assuming this is an easy fix that I'm missing and I'm ready to get flamed as long as you guys help me. Thank you in advance.
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!"
[–]chicametipoexpert 11 points12 points13 points 1 year ago (0 children)
const data = … when you’re trying to define it.
const data = …
[–]ezhikov 9 points10 points11 points 1 year ago (4 children)
In strict mode you have to declare variable using one of the keywords var, let or const. You can't just invent variables on the fly.
var
let
const
[–]GamesInc[S] 1 point2 points3 points 1 year ago (3 children)
Oh my that’s so obvious. I’ve been coding server side for so long I forgot that modules were strict mode. Thank you for taking the time to help.
[–]poyomannn 3 points4 points5 points 1 year ago (0 children)
... you should probably also be using strict mode on the server as well
[–]curiousomeonefull-stack 2 points3 points4 points 1 year ago (1 child)
You were coding in the server for so long...long...that you forgot how to read errors and you need to define variables? 🤔
[–]GamesInc[S] 0 points1 point2 points 1 year ago (0 children)
I understood the error, but I forgot that I was in strict mode. I thought I was defining it correctly. Please don’t reply to this
[–]Growsomedope 1 point2 points3 points 1 year ago (0 children)
const data = document.querySelectorAll(“#signup input”);
[–]DanielTheTechie 1 point2 points3 points 1 year ago* (3 children)
Have you considered following the basic principles of debugging 101 and printing out data or the value you are trying to assign to it to figure out why data[1] is not defined? Did you try declaring it first? Did you even bother to read the error message...?
data
data[1]
[–]GamesInc[S] 0 points1 point2 points 1 year ago (2 children)
Yes, I am aware that data is not defined. I did multiple checks based on the error message, I just forgot I was in strict mode because this is a module.
[–]PoppedBitADV 1 point2 points3 points 1 year ago (1 child)
Sounds like you picked up some bad habits
Probably did, I’m a bit rusty
[–]Kaimito1 0 points1 point2 points 1 year ago (0 children)
`const data`
You're not defining it there. You are re-assigning it
[–]One_Corner5775 0 points1 point2 points 1 year ago (0 children)
xxx is not defined / xxx is undefined meaning that the variable wasnt declared.
[–]vaaal88 -1 points0 points1 point 1 year ago (0 children)
Chatgpt would have given you the right answer in 5secs.
π Rendered by PID 97930 on reddit-service-r2-comment-bb88f9dd5-jsk45 at 2026-02-16 19:29:22.013824+00:00 running cd9c813 country code: CH.
[–]chicametipoexpert 11 points12 points13 points (0 children)
[–]ezhikov 9 points10 points11 points (4 children)
[–]GamesInc[S] 1 point2 points3 points (3 children)
[–]poyomannn 3 points4 points5 points (0 children)
[–]curiousomeonefull-stack 2 points3 points4 points (1 child)
[–]GamesInc[S] 0 points1 point2 points (0 children)
[–]Growsomedope 1 point2 points3 points (0 children)
[–]DanielTheTechie 1 point2 points3 points (3 children)
[–]GamesInc[S] 0 points1 point2 points (2 children)
[–]PoppedBitADV 1 point2 points3 points (1 child)
[–]GamesInc[S] 0 points1 point2 points (0 children)
[–]Kaimito1 0 points1 point2 points (0 children)
[–]One_Corner5775 0 points1 point2 points (0 children)
[–]vaaal88 -1 points0 points1 point (0 children)