2,521,979 questions
Score of 0
0 answers
9 views
javascript accessing object value or name
I'm a bit lost in handling JavaScript objects. I understand how to access instance and class variables in other languages and was doing fine in JavaScript with my own objects but I'm a bit puzzled ...
Score of -4
0 answers
62 views
Fast client-side video compression in React — alternatives to FFmpeg.wasm? [closed]
I’m working on a React/TypeScript application where users upload videos. I need to compress the video entirely on the client side (in the browser) before uploading it to my server.
My main requirement ...
Score of 0
0 answers
40 views
Google Maps Distance Matrix API returning ZERO_RESULTS for valid local US addresses in JavaScript fetch [closed]
async function calculateDistance(origin, destination) {
const apiKey = 'MY_API_KEY';
const encodedOrigin = encodeURIComponent(origin);
const encodedDestination = encodeURIComponent(destination);
...
Score of -8
2 answers
120 views
How can I work with multiple variables in one Function in Javascript [closed]
I'm just learning about functions and seems like the whole idea of expressions via my variables is a façade.
I'm writing a quadratic equation solver and can't seem to make my root1 and root2 variable ...
Score of 1
1 answer
87 views
How should a React app handle API data when the user navigates away before the request finishes?
I am building a React application that fetches data from an API when a user opens a page.
The problem is that the user can navigate to another page before the API request finishes. When the request ...
Score of 1
0 answers
51 views
Why does React render an intermediate state between two setState calls? [duplicate]
I have built an AddressSearch page but the behaviour is not as expected.
How does it work?
There is a search input field in which user enters the address and Google Maps JS API suggest some options ...
Score of 1
1 answer
84 views
is JSEvent a macro task or synchronous task? [duplicate]
Is JSEvent a macro task or synchronous task?
For JSEvent, I mean programmatically dispatched events, e.g., window.click().
This question has stuck with me for a long time. Some told me it was a macro ...
Score of 0
0 answers
70 views
Canvas click hit-testing vs devicePixelRatio scaling — why doesn't click code need the ratio? [closed]
I'm drawing a graph on <canvas> where nodes have fixed logical coordinates (e.g. in a 1100×620 "design space"), and I scale/translate them to fit the actual rendered canvas size, plus ...
Score of -3
0 answers
86 views
How to capture original state of a container? [closed]
I'm building a feature where users can select a container (for example, a navbar) and preview different design styles using Next/Previous buttons.
Before applying any changes, I want to save the ...
Score of -4
0 answers
75 views
Dynamically inserting many <img> elements with JavaScript causes HTTP 429, but equivalent static HTML does not [closed]
I have a static website with a page containing roughly 60 cards. Each card has an image, and there are also Bootstrap modals containing additional images.
Originally, all of the cards and modals were ...
Score of -6
0 answers
49 views
Why does my React component fetch data again when I navigate back to the page? [duplicate]
I'm building a React application where data is fetched from an API when a page loads.
When I navigate to another page and then return to the original page, the component mounts again and the API ...
Score of 2
2 answers
153 views
Text alignment on a dynamically created HTML element via JavaScript not working
I have a <p> element which is dynamically created using JavaScript when the user presses a button on the site, and I want this element to be horizontally centered, however for whatever reason ...
Score of -1
2 answers
138 views
Google Maps Distance Matrix API returning 'ZERO_RESULTS' for valid local addresses in JavaScript [closed]
I am building a service radius calculator for a local business web app. I am intermittently getting ZERO_RESULTS from the Google Maps Distance Matrix API, even though the addresses are completely ...
Score of -3
0 answers
73 views
How can I trace the root cause of a Node.js error when the stack trace only shows the final failure? [closed]
I'm debugging a Node.js application where an error is being thrown several steps after the data enters the application.
The error looks like this:
TypeError: Cannot read properties of undefined (...
Score of -2
0 answers
80 views
How can I quickly identify the font used on a webpage using JavaScript? [duplicate]
How can I quickly identify the font used on a webpage using JavaScript?
I’m building a small JavaScript utility for web designers and I want to identify the font being used for a particular piece of ...