so I’m doing a project where I am fetching an HTML file and replacing the body content with the file I’m fetching. So I have index.html and result.html. I have managed to get the content to switch based on the “matching search result in my input field”. But the problem I have is that t…
Category: Questions
Reading backend data, ISO format date
I get data from the backend that look like that start: ‘2022-10-22T00:00:00Z, end: ‘2022-10-26T00:00:00Z regarding the discount of a product. So that basically means that the product is discounted until 25.10.22 until 23.59, right? Thought it would be until 26.10.22 until 23.59 and got a bit confu…
PHP JavaScript – Escaping variables written like ${HOST}
How to escape variables from DB like ${HOST}? The situation happens when there is some code posted in tags <pre><code>. If it remains as it is there’s the error Uncaught ReferenceError: HOST is not defined. It’s needed in a context where it’s required to use the character ` for e…
How to query based on a field in a referenced document in mongodb
I have two MongoDB collections. First is Products, and the seconds is Users. The product documents has a field ownerId which refers to the users collection and the user has a Boolean field isActive. What I want to do is to find all the products where their users are active using Mongoose method collection.fin…
I’m making a button using the state, but it doesn’t work
I’m trying to make a button now. If I keep clicking the button using onClick function and state, I want to see the two buttons alternately. But it’s applied at first, but the button isn’t applied after second. Button’s code is the same, but I don’t know why it works only once. I&…
How can I remove duplicate strings from an array of strings but only if they start with the same 5 characters in JS?
I have a nodelist: Every “a” contains a string In the example the list is like that: I need to remove for example the the third element because it starts with the same 5 characters of the second element even though they end differently. Everytime I encounter a new element I need to check if there&…
Consider adding an error boundary to your tree to customize error handling behavior in Functional Component
I have been working on an admin-Ui project. where I require to display data in a table format and do some pagination. Firstly I have used use effect to fetch some data from an API on page load. All imports are done properly. While running this code the application shows an array that data is undefined. and pr…
How do I remove double quotes from a multidimensional array?
Q: Did you find the same question asked before? A: Yes, here’s the link to the question exactly looks like mine but the answers are not applicable because it converts the string to a number. Q: Why do you need to remove the double quotes? A: Because I need to follow the syntax allowed for moment js. Q: …
React: Get all data from Table from a onclick function
I have react app with a react-spreadsheet component and a button. I am trying to get the data from the spreadsheet on the onclick() event of the button. I am trying to get the data added to the spreadsheet via the webpage inside a JavaScript function. Is there a way to get the react-spreadsheet data(if any ad…
Are v8’s optimizations deterministic? Extracting the sequence of JS functions executed by any given webpage
I am trying to reconstruct the exact sequence of executed Javascript functions (call graph) from log data gathered using the Tracing Profiler, particularly from the category “v8.cpu_profiler”. Unfortunately, the number of nodes (function definitions) and edges (function calls) I obtain fluctuates …