I have the following code: the console.log in count() is defined and working fine, but when i try to use this.dust in buyBook() it returns as undefined. Why is this and how do I fix it? Answer You want to bind the this context for buyBook, or the event handler will redefine the this context. Edit: Also, I thi…
javascript: onclick=”scrollWin()” doesn’t work as intended
I have the following simple page: a header with a name on the top left that disappears when you scroll down (you see the menu on the bottom right instead) a fixed background picture (parallax) and a menu at the bottom right corner which shows up when scrolling down (because of the parallax) Apart from scrolli…
Discord music bot: prefix not defined
I wanted to make a music discord bot and I’ve been having trouble with it for a while. and I keep getting an error and I got this code from CodeLyon’s video called “Make Your Own Discord Bot | Music Bot (Play, Skip, Stop Commands)” I keep getting the same error when I try it: Reference…
Dynamically select which array to run through funciton
I am trying to make a jQuery function dynamically decide which array gets run through it based on a button click. Ideally, this is how it would work: User clicks one of the “View More …” buttons. The program loads the next 3 images of that specific category (Sports, Concerts, etc.). Below is…
DId firebase createUserWithEmailAndPassword() change the return value?
I have been using this code for a year now: However I had complaints over the last 2 days of new users having trouble creating a new login. I checked the “user” variable in this code and it looked like this: Which means that I now have to refer to uid by using user.user.uid instead of user.uid. I …
JQuery – Adding random numbers to an array and then checking if there are repetitions before printing array
I’m trying to write a “for” loop that will go through a list of 30 songs in an array and then print a list of 20 random items in that array with no repetitions. Answer If I only focus on the question title. Adding random numbers to an array and then checking if there are repetitions before p…
Dragging not working for react-use-gesture
For some reason, I just cannot get the most basic example of react-use-gesture to work. What I am trying to do is just have a square follow my mouse location when you drag it. I copy-pasted the example from their documentation multiple times (https://github.com/pmndrs/react-use-gesture) and still cannot get i…
How to pass a state to a Parent component if I have a button triggering the state in the 2nd Child in React
Hi there, The issue that I faced recently is the next: I have a parent component MainPage, that has child components ModalJoin (is not shown by default) and ExploreProjects in it. This ExploreProjects component has its own child component ProjectCard which has a button that is supposed to change a state so Mo…
Php file won’t load ajax request
I try query my database from javascript, using ajax request to my php file. This is my code: So I included jquery file into my folder, so that I can access it as shown above. Now my trainPassFrequency.js look like this: where trainfrequency.php only returns (echo) output of the sql query. When I run this code…
‘Range not found’ when trying to input value into first empty cell
Google Script/Spreadsheet issue, here. Am trying to copy data from one cell and put it into the first empty cell in column E. When I perform the following, I get ‘Range not found’ on line 15: I’ve tried replacing report.getRange(lastRow).setValue(row[1]); with something like report.getRange(…